• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

My SCJP Preparation Notes

 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, ranchers
You can find my SCJP preparation notes here
Jamal's Preparation Notes
Jamal
SCJP
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Val, but I didn't understand you. (I mean chess) ???
Anyway, thanx for reply.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
great notes Jamal ! A+
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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");

}catch (FileNotFoundException fne) {
System.out.println("No such file found");
return -1;
}catch(IOException ioe) {
} finally{
System.out.println("Doing finally");
}

return 0;
}
}

I confused...Need your help


Tina
 
Neelima Rao
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tina,
This statement is true only for FileOutputStream.
(Not for FileInputStream)

"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.


FileInputStream does not create a new file. If the specified file does not exist, it'll throw a FileNotFoundException.
HTH.....
 
Tina Ang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
got it! Thanks!!!
Tina
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In java.awt:
First line says:


TextArea and TextField classes has setColumns(int) and setRows(int) methods !!!


I dont think TextField has setRows(int) method. Only TextArea does.
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neelima,
I'll correct this.
Thanx,
Jamal
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,Jamal
I am a little disappointed that I can't open the page.
You do help me,don't you
thanx so much.
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Calrole,
I think there were problems in yahoo server. Try again.
http://www.geocities.com/itjamal/SCJPENotes.html
If some problems, contact me.
Jamal Hasanov
[email protected]
 
calrole huang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jamal:
I really need your help now.
Are there other ways to get it?
Or could you send it to me at [email protected]
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Calrole, no problem-I'll send it you in .DOC format.
With best regards,
Jamal. :-)
 
The problems of the world fade way as you eat a piece of pie. This tiny ad has never known problems:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic