Hi Jamal, Cool page How about chess? I couldn't seem to hold off my chess whenever I'm hacking Java. Do you stop by KasparovChess.com Playing Zone once in a while? OK, my handle is "pecaocov". Maybe we could play a game or two. And hey man, congrats. After you, man! Ex Animo Java! -- Val
"Knowledge is power, but enthusiasm is the key." -- Lavern Barn
Jamal Hasanov
Ranch Hand
Joined: Jan 08, 2002
Posts: 411
posted
0
Sorry Val, but I didn't understand you. (I mean chess) ??? Anyway, thanx for reply.
Hi Jamal, Congratulations...Your notes is excellent....... In Overriding section: 3rd point says,
The throws clause of the overriding method must <B>only</B> specify exceptions that are in the throws clause of the overridden method
But an overriding method can also throw exceptions that are subclasses of the exception which is thrown in the overridden method. In Collections, did you get any questions regarding methods in Collection interfaces? TIA....
Jamal Hasanov
Ranch Hand
Joined: Jan 08, 2002
Posts: 411
posted
0
No Neelima, You needn't learn all methods of LinkedList,Collection,HashMap or etc. Exam will ask you concrete things! You had to learn 3 things : 1-Learn hierarchy (you may get questions like this:"What is the parent of HashMap interface?" (P.S.THIS IS NOT A QUESTION FROM REAL EXAM!) 2-Remember that: TreeMap & TreeSet has comparator() methods Vector&Hashtable are only synchronized collections. 3-Of course,about unique,nonunique,sorted,etc. behaviours. That's ALL!!! Nothing else !! LEARN THE COLLECTIONs HIERARCHY !!! P.S. When I started exam,I drawed this tree in paper and began answer questions quickly. By The way, Unlike other BIG notes,my notes hold necessary information ( not every word from books:-) ). I gonna update my notes to improve the quality. That's why I suggest not to download my notes,because periodically I'll update my notes. Whishing all the best in your study With best regards, Jamal Hasanov SCJP2
Jamal: I have a question about Math.round(). In your note round(x)=truncate(x+0.5). I do not think that is correct. According to API, round(x)=floor(x+0.5). That's why round(-2.6)=-3. Yao
Jamal Hasanov
Ranch Hand
Joined: Jan 08, 2002
Posts: 411
posted
0
Dear Yao, You are right. I knew that but forgot to correct. BTW,there is no truncate() function in Java. Thanx a lot Yao, I ask everyone to check errors like this and inform me. Jamal
If you did want to truncate in Java, just cast a floating point number to an integral. Eg: the following code will set i to 20
Regards, Matt
Jamal Hasanov
Ranch Hand
Joined: Jan 08, 2002
Posts: 411
posted
0
Matthew, I know that truncate is possible. ( I wrote that there is no truncate() function. I meant function (not functionality) inside Math class) Thanx for reply, Jamal
Originally posted by Jamal Hasanov: Hi, ranchers You can find my SCJP preparation notes here Jamal's Preparation Notes Jamal SCJP
neat notes. grab for learning
Thank Folks who <b>Make Sense</b> here.<br />SCJP Platform 2
Jamal Hasanov
Ranch Hand
Joined: Jan 08, 2002
Posts: 411
posted
0
Thanx a lot, WiLL I'm gonna to update this notes every week. I've added necessary tips to my notes(that's why it's just 8 pages). No additional unneeded info! I'll add some tips about overriding and inheritance tips next week. Thanx a lot. Jamal
Hi Jamal! File Input/Output Streams you've written that: "If the file does not exist, it is created. If it exists, its contents are reset, unless the appropriate constructor is used to indicate that output should be appended to the file. A SecurityException is thrown if the file does not have write access or it cannot be created. but how come the following code does not create the Hello.txt file? the output of the code is: No such file found Doing finally -1
From Valiveru's Exam Applet import java.io.*; public class MyClass3 { public static void main(String[] args){ MyClass3 mc=new MyClass3(); System.out.println(mc.myMethod()); } public int myMethod() { try { FileInputStream dis=new FileInputStream("Hello.txt");
"If the file does not exist, it is created. If it exists, its contents are reset, unless the appropriate constructor is used to indicate that output should be appended to the file. A SecurityException is thrown if the file does not have write access or it cannot be created.
Yes Tina, I meant FileOutputStream. (I'll update this in 1.4 version). BTW, ranchers, what do you think about my notes? What should I add ? Thanx a lot for your attention and reply. Jamal. SCJP
Neelima Rao
Greenhorn
Joined: Feb 24, 2002
Posts: 26
posted
0
In java.awt: First line says:
TextArea and TextField classes has setColumns(int) and setRows(int) methods !!!
If superclass constructor throws an exception, then subclass constructor (which calls superclass constructor) MUST throw (or declare try/catch) this exception (or subclasses of this exception).
But look at the code below: Super { public Super() throws IOException{ } }
/*** will give error **** public Super() throws InterruptedIOException { } *******************/ }
So which is correct? can the subclass constructor throws subclasses of superclass exception only?
Jamal Hasanov
Ranch Hand
Joined: Jan 08, 2002
Posts: 411
posted
0
Xu, it's just a typo. I'll correct this. ===================================== Super { public Super() throws IOException{ } } public Subclass extends Super{ public Subclass() throws IOException { } /*** will give error **** public Subclass() { } *******************/ // no constructor(default) will also give error } ======================================= Thanks a lot. Jamal.
Studying Collections, and have a small question... on your diagram tree, did you mean ArrayList instead of "Array" falling under (implementing) List? I'm hoping you didn't mean the Arrays class! (basing this off 1.4 API)
Originally posted by Jamal Hasanov: No Neelima, You needn't learn all methods of LinkedList,Collection,HashMap or etc. Exam will ask you concrete things! You had to learn 3 things : 1-Learn hierarchy (you may get questions like this:"What is the parent of HashMap interface?" (P.S.THIS IS NOT A QUESTION FROM REAL EXAM!) 2-Remember that: TreeMap & TreeSet has comparator() methods Vector&Hashtable are only synchronized collections. 3-Of course,about unique,nonunique,sorted,etc. behaviours. That's ALL!!! Nothing else !! LEARN THE COLLECTIONs HIERARCHY !!! P.S. When I started exam,I drawed this tree in paper and began answer questions quickly. By The way, Unlike other BIG notes,my notes hold necessary information ( not every word from books:-) ). I gonna update my notes to improve the quality. That's why I suggest not to download my notes,because periodically I'll update my notes. Whishing all the best in your study With best regards, Jamal Hasanov SCJP2
SCJP2 (1.4)
Jamal Hasanov
Ranch Hand
Joined: Jan 08, 2002
Posts: 411
posted
0
Yes Toby, You are right. This is a typo: there must me ArrayList instead of Array. I've corrected this. Thanx a lot for correction. Jamal