There are (at least) three ways.
Use the DatabaseMetaData class. There's a lot in there, so for details see the Java Docs. I believe this is the preferred way, as it is standard across all database engines. So if you switch to a different database engine, it shoudl still work, and what you learn about how to use it will apply whether you are working on this db engine or another.
Do queries against the "information_schema". Basically this is a database with information about the database structure. It has tables listing all the tables, all the columns, etc. This is the second-best choice. The information_schema is more or less standard across databases. Unfortunately, the implementation for MS SQL Server is not the best.
Do queries against the "system tables" and/or "system views". There are a set of tables in MS SQL Server with information about the database structure. Like information_schema, but it's specific to MS SQL Server and thus includes metadata for things that are not part of standard SQL, like calculated fields and identity columns. It's also more complete and reliable than MS's implementation of information_schema.
For really general stuff, like what tables are in the DB or what columns are in a given table, information_schema and the system tables are equally good and useful. But if you need much of anything else, MS's implementation of the information_schema quickly proves inadequate. I've seen lots of comments on the Web encouraging developers to use the system tables rather than the information_schema. I don't like to use non-standard stuff, as both the code itself and the experience gained are not portable, but in this case, I think they're right: use the system tables.
But DatabaseMetaData is better yet, if it gives you what you need.