1.) The Java 2 Cert guide has question... Which of the ff. signatures are valid for the main() method entry point of application. the answers are... public static void main(String args) public static void main(String args) public static int main(String args) how come the third one?
2.) Another is.. in java API docs... The class PrintWriter states... Methods in this class never throw I/O exceptions. The client may inquire as to whether any errors have occurred by invoking checkError(). ..but methods such flush(),close(),write(),print() throws IOException... is this contradicting? 3.) About Collection... Is there any real world application or practical application that uses collection classes? All i know is for table of information than can use for database application. Thanks...
I'm not sure about the first two, but Collections are used all the time. If you write a video store application, you'll need to keep a List of videos the customer is renting. Maybe you'll have an employee screen, so you'll want to display a Set of all the employees on the screen. If you want to keep track of the days overdue for each video, you could have a Map with the video as key and days late as value. I hope these few examples help.
RE: First question of the three - main signatures. Which Java Certification guide are you using for this? The reason I ask is when I was studying for my Cert (it's been almost 2 years now) I had used the Boone and Stanek book which was horrible! It was riddled with so many errors that the only value the book had was that I had to check every single thing to verify it was correct so I learned stuff that way. The Java 2 Exam Notes and Java 2 Exam Cram books were great and when I sent some errata to Sybex for the Java 2 Exam Notes they sent me a nice e-mail from the publisher and another e-mail from the author confirming the errors. In my opinion, the first two are in fact valid signatures if you want the main() to run because you can have the array declaration on either side. It could be that they're saying the third is a valid signature in general but it will not work if you're trying to use it as the 'main' called to run as an application. You may want to e-mail them and ask for clarification.
Greg Ostravich - SCPJ2
Joined: May 05, 2000
Question 1 is an error and was corrected in later printings.
Joined: Jun 06, 2002
thanks for the time you spent to answer...I appreciate it very much...