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...
Lance Finney
Ranch Hand
Joined: Apr 26, 2001
Posts: 133
posted
0
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.
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Methods in the PrintWriter class don't throw exceptions. Inherited methods might.
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
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Question 1 is an error and was corrected in later printings.
Nelson Nadal
Ranch Hand
Joined: Jun 06, 2002
Posts: 169
posted
0
thanks for the time you spent to answer...I appreciate it very much...
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.