aspose file tools
The moose likes Beginning Java and the fly likes Which Class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Which Class?" Watch "Which Class?" New topic

Which Class?

Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
In my undeniable capacity as Java newbie on this forum, the one thing I am becoming increasingly conscious of is my lack of knowledge of the myriad of standard Java classes out there, and their associated variables and methods.
That is, I may be trying to write some complicated code in my program when there may already be a simple solution provided by one (or more) of these Java classes
Question is:
1) How do I find the class I'm looking for (eg. in the Sun Java API docs)?
2) How well do I need to understand the Java class and interface hierachies?
3) Which classes are used most frequently and which are more specialised?
4) Which classes are the prime focus of the certification exam?
[This message has been edited by mark howard (edited February 19, 2001).]
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
The API for the 1.3 release is at:
We all struggle with getting to know all the stuff that is out there. Of course the more familiar you are with the API the easier life is, however the only way to get familiar with it is to keep reading and trying code.
You need to understand Class and Interface heirarchies in theory. You do not need to memorize the actual heirarchies - that will come with experience - that's why the API is SOOOOOOO important.
Which classes are used more depends on what kind of programming you are doing. If you are heavy into GUIs you may not use the JDBC stuff much, and visa versa. Not all applications HAVE a GUI.
You do not have to be particularly familiar with most of the existing Classes for the exam, however you should know some of the more common util classes, and of course System.out (like println etc). You should also be familiar with the AWT like Components, Panels, Frames, Applets etc. along with their layout managers. There is no Swing on the exam.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

When I was beginning Java I ran into the same problem as you... I would be writing code for things which were already done in the Java APIs... it's pretty much a thing that you pick up with experience...
Here are the answers to your questions (as far as I know ) -
1.) The classes in the Java API docs are located in packages, so if you are looking for things related to networks (i.e. sockets, URL & other protocols ) you would look in, if you were looking for GUI building you would look in java.awt, javax.swing, or one of the many subpackages of these packages. The packages are listed out in the upper left frame of the API doc HTML. I admit that I still sometimes have problems finding the specific class I need and have to go searching through the docs blindly. ( I am still waiting for Sun to put a search engine type interface into the Java API documentation... )
2.) Knowledge of the API will certainly speed up programming, but you don't have to have a perfect knowledge of all this... that's what the API docs are for!
3.) I believe you meant what packages are used more frequently... of course, this depends on your program, but the most commonly used (by me) are java.applet (for applets...), java.awt (for GUIs), (for input/output), java.lang (the actual language which is imported with every program...), and java.util (which provides some helpful classes for things like collections, dates, string tokenization, etc.). You can see what packages are used for on the overview-summary page of the API docs.
4.) The SCJP exam covers the following packages : java.lang, java.awt,, and java.util

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Which Class?
It's not a secret anymore!