tips to clear scjp exam

Upload: rathumca8943

Post on 03-Jun-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Tips to Clear SCJP Exam

    1/44

    Tips to clear SCJP exam

    Tips to clear SCJP exam

    1) Give yourself atleast 3 months for preparation

    2) Study at least one boo preffered!"#$3) Try %ritin& the pro&rams %ith experiments') $e very clear about overloadin& and overridin& rules() Give 1*2 SCJP moc exams+ Some are available on this blo& at!SCJP ,oc exam archive-) $e clever in ommitin& options.) /very 0uestion %ill have 2 fixed options Compilation error and exception at runtime)) oo carefully to find ho% many choices are to be mared4) Go on to solve 0uestions that have less to read and easy to ans%er as by the end ofSCJP exam you %ill be &ettin& exhausted and loosin& patience1) 5irst &uess %hich concept is bein& tested and then brin& out all the facts about that

    concept from the bac of your mind+11) There is an option to ,ar the 0uestion so that before closin& the test you can easilyfind %hich 0uestion you %ant to revie%+ 5or each 0uestion you have doubt6 chec thechecbox labeled ,ar at the top left corner+

    7appy SCJP Cracin&+eave your comments about this post+You might also like:

    7o% to Send 7TTP P8ST 9e0uest in Java

    Java :erbose 8ptions for 9unnin& Pro&rams

    9/ST ;eb Service

  • 8/12/2019 Tips to Clear SCJP Exam

    2/44

    %e loo at 7ash,ap6 there can be one ey as null as the eys are uni0ue and hence not%o eys as null+ $ut values for multiple eys can be null in case of 7ash,ap+

    e0uals method on arraysThe e0uals method is not overloaded for arrays %hich means that!

    intBa D ne% intBE1FintBb D ne% intBE1FSystem+out+printlna+e0ualsb))

    %ill return false because it %ill be the e0uals) method 8bHect class that %ill be called and%e no% that this version of e0uals) method checs for the obHect references and not thevalues hence false+

    How man! choices to choose in SCJP exam

    "f !ou are wondering as to how to find out which choices are correct in a#uestion ha$ing multiple choices as answer%

    The exam will pro$ide !ou the information on how man! choice to

    choose for each #uestion% &$en if it is one choice' it will be

    mentioned% The text will go like:

    Choose ( correct options%

    )e end b! pro$iding a sample #uestion:

    )hich of the following are a part of Collections

    a* +eflectionb* Set

    c* HashMap

    d* Cell

    Choose ( correct options

    ,nd !ou will answer: b and c

    )hat is ConcurrentModification&xception

    Concurrent,odification/xception is thro%n %hen you remove the elements of aCollection usin& its method instead of the one provided by the P< says that this behaviour is not &auranteed+

    what is reflection ,P"

    http://extreme-java.blogspot.com/2008/12/equals-method-on-arrays.htmlhttp://extreme-java.blogspot.com/2008/12/how-many-choices-to-choose-in-scjp-exam.htmlhttp://extreme-java.blogspot.com/2008/12/how-many-choices-to-choose-in-scjp-exam.htmlhttp://extreme-java.blogspot.com/2008/12/what-is-concurrentmodificationexception.htmlhttp://extreme-java.blogspot.com/2008/09/what-is-reflection-api.htmlhttp://extreme-java.blogspot.com/2008/12/equals-method-on-arrays.htmlhttp://extreme-java.blogspot.com/2008/12/how-many-choices-to-choose-in-scjp-exam.htmlhttp://extreme-java.blogspot.com/2008/12/what-is-concurrentmodificationexception.htmlhttp://extreme-java.blogspot.com/2008/09/what-is-reflection-api.html
  • 8/12/2019 Tips to Clear SCJP Exam

    3/44

    $esides creatin& obHects of a class and callin& constructors@methods on that obHect6accessin& the properties@variables of the class6 theres is somethin& else %hich can be done%ith the classes+ The reflection is a reflection of a class as seen by the J:,+ The J:,%ill see a class as havin& some methods6constructors6instance variables etc+ The motherof reflection >P< is the Class class+ 5or every class that is present in a pro&ram or

    provided by SI as part of Hava >PPP< and the Class class+

    The bottomline of all this discussion is that a instance of the Class class reflects an!

    class%

    o% %e modify the bar class as sho%n belo%!import foo @@modify as per your proHect settin&s+public class barEfoo f1 D Class+forameLfooL) @@created the foo obHectClass c1 D foo+classHava+lan&+reflect+ConstructorB const1 D c1+&etConstructors)System+out+printlnconst1B+&etame))F

    7ere %e &et the instance of the Class class correspondin& to the foo class and then &et anarray of its constructors by invoin& the method &etConstructors) on it and then displaythe name of the first constructore present in the foo class+

    < hope this has made thin&s more clear and no% you can bro%se the Hava+lan&+reflectpaca&e to no% more about %hat can be done %ith the reflection >PP< because all this happens atruntime6 the performance may be effected because of over usin& the reflection >P

  • 8/12/2019 Tips to Clear SCJP Exam

    4/44

  • 8/12/2019 Tips to Clear SCJP Exam

    5/44

    SingleThreadModel implementation

    Qpplication

    /ink)ithin

    Conditional 0&T re#uests

    P1ST&2 3Y S,42&&P

    /,3&/S: C142"T"14,/ 0&T +&-.&STS' HTTPS&+5/&T6 C1MM&4TS

    > conditional &et operation is one %here the G/T re0uest is issued only after somecondition is met+ The &etast,odified) method of 7ttpServlet &ets a resource only if ithas been modified since a specified time+ This means that the server %ill not send theresponse to a G/T re0uest if the criterion of modification is not met+You might also like:

    Java :erbose 8ptions for 9unnin& Pro&rams

    ,y ist of Top 2 Java 9elated $oos

    9/ST ;eb Service pplication

    /ink)ithin

    http://extreme-java.blogspot.com/2008/08/singlethreadmodel-implementation.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/05/how-to-iterate-arraylist-in-struts2.htmlhttp://extreme-java.blogspot.com/2011/02/develop-java-ee-web-services-with.htmlhttp://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2008/08/conditional-get-requests.htmlhttp://extreme-java.blogspot.com/search/label/Conditional%20GET%20requestshttp://extreme-java.blogspot.com/search/label/HttpServlethttp://extreme-java.blogspot.com/2008/08/conditional-get-requests.html#disqus_threadhttp://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/05/rest-web-service-interview-questions.htmlhttp://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=5123933223433541540&from=pencilhttp://extreme-java.blogspot.com/2008/08/singlethreadmodel-implementation.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/05/how-to-iterate-arraylist-in-struts2.htmlhttp://extreme-java.blogspot.com/2011/02/develop-java-ee-web-services-with.htmlhttp://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2008/08/conditional-get-requests.htmlhttp://extreme-java.blogspot.com/search/label/Conditional%20GET%20requestshttp://extreme-java.blogspot.com/search/label/HttpServlethttp://extreme-java.blogspot.com/2008/08/conditional-get-requests.html#disqus_threadhttp://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/05/rest-web-service-interview-questions.htmlhttp://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://www.linkwithin.com/learn?ref=widget
  • 8/12/2019 Tips to Clear SCJP Exam

    6/44

    )eb Ser$er and Ser$let Container

    P1ST&2 3Y S,42&&P

    /,3&/S: S&+5/&T C14T,"4&+' )&3 S&+5&+6 C1MM&4TS

    The servlet container %ors %ith a %eb@application server+ The servlet containerreco&ni?es re0uests of particular format and sends the response bac after processin&+The %eb server intercepts the 7TTP re0uests from client and for%ards to the servletcontainer+ The servlet container can be implemented in three %ays

    1) $uilt into %eb server2) $uilt as an add*on component of %eb server3) $uilt as a separate process+You might also like:

    Sho%in& Generic /rror Pa&e in Struts2 ;eb >pplication

    ,y ist of Top 2 Java 9elated $oos

    Java :erbose 8ptions for 9unnin& Pro&rams

    evelop Java // ;eb Services %ith /clipse6 >Q

  • 8/12/2019 Tips to Clear SCJP Exam

    7/44

    class 5oo EESystem+out+printlnLfooL)Fstatic E

    System+out+printlnL5oo staticL)FF

    public class $ar extends 5ooEESystem+out+printlnL$arL)F

    static ESystem+out+printlnL$ar staticL)

    F

    public static void mainStrin&B ar&s) E$ar b1 D ne% $ar)$ar b2 D ne% $ar)F

    FYou might also like:

    Sho%in& Generic /rror Pa&e in Struts2 ;eb >pplication

    evelop Java // ;eb Services %ith /clipse6 >Q

  • 8/12/2019 Tips to Clear SCJP Exam

    8/44

    Class 5oo extends $arEF

    Class $ar extends 5ooEF

    results in compiler error+

    You might also like:

    Java :erbose 8ptions for 9unnin& Pro&rams

    ,y ist of Top 2 Java 9elated $oos

    evelop Java // ;eb Services %ith /clipse6 >Qpplication

    /ink)ithin

    inheritance in =a$a

    P1ST&2 3Y S,42&&P 14 J./ >6' (669

    /,3&/S: "4H&+"T,4C& "4 J,5,6 C1MM&4TS

    "nheritance in Ja$a means extension and code reuse as in term of ob=ect orientation

    with some difference in implementation%

    The class which pro$ides the general functionalit! is known as superclass'

    base class or parent of its children and the class which inherits this class is

    known as subclass' deri$ed class or child of base class%

    ,n example of inheritance can be a $ehicle and the car classes% )hile a car is

    a $ehicle but a $ehicle ma! or ma! not be car and ma! be a truck?bus% The

    Car class will inherit the $ehicle class which can pro$ide the basic properties

    of a $ehicle which is sure to be present in the car like appl!3rake' accelerate

    etc%

    The Car class will add more properties specific to a car%

    ,s a $ehicle will alwa!s be concrete hence the 5ehicle class should be

    abstract which means that a new instance of 5ehicle class can@t be created

    using the new operator%

    Coming back to inheritance' creation of 5ehicle class makes it eas! to code as

    there is no need to implement each method which a 5ehicle is supposed to

    implement%

    http://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/02/develop-java-ee-web-services-with.htmlhttp://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2008/07/inheritance-in-java.htmlhttp://extreme-java.blogspot.com/search/label/inheritance%20in%20javahttp://extreme-java.blogspot.com/2008/07/inheritance-in-java.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=4419222881734312452&from=pencilhttp://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/02/develop-java-ee-web-services-with.htmlhttp://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2008/07/inheritance-in-java.htmlhttp://extreme-java.blogspot.com/search/label/inheritance%20in%20javahttp://extreme-java.blogspot.com/2008/07/inheritance-in-java.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    9/44

    21M parsing

    P1ST&2 3Y S,42&&P

    /,3&/S: 21M ,P"'P,+S"40 ;M/ 21C.M&4TS6 C1MM&4TS

    5unction to &et document by 8, parser

    public static synchroni?ed ocument loadStrin& filename6 Strin& filePath)thro%s /xception Eocument doc

    ocument$uilder5actory factory D ocument$uilder5actory+ne%

  • 8/12/2019 Tips to Clear SCJP Exam

    10/44

    S,; Parsing

    P1ST&2 3Y S,42&&P

    /,3&/S: P,+S"40 ;M/ 21C.M&4TS'S,; ,P"6 C1MM&4TS

    S>Q parser can be created usin& either the xerces or J2S/ >PQParser+

    8n callin& the parse method of S>QParser6 the document is parsed and some events areraised

    parser+parsene%

  • 8/12/2019 Tips to Clear SCJP Exam

    11/44

    ,bstract classes in Ja$a

    P1ST&2 3Y S,42&&P 14 J./ 8' (669

    /,3&/S: ,3ST+,CT C/,SS&S' J,5,' SCJP' SCJP 8%D6 C1MM&4TS

    >n abstract class is lie a normal class %ith the difference that it contains at least oneabstract method or it extends another abstract class+Thus the t%o conditions under %hich a class is and must be declared as abstract are!8* "t extends another abstract class

    (* "t declares an abstract method%

    The above implies that at some point the hierarchy of abstract classes6 one class musthave declares an abstract method+ So letMs discuss an abstract method+ >n abstractmethod loos lie!

    abstract void foo();

    The difference bet%een this and a normal method is that the abstract methods donMt havemethod body+ This means to compiler that the current class is not meanin&ful in the real%orld scenario and some other class %hich %ill be extendin& this class %ill providecomplete definition of the abstract method+ n abstract class definition loos lie!

    abstract class Myfoo {

    abstract void foo();}

    or it can be

    abstract class Myfoo {}

    or

    abstract class Myfoo {

    abstract void foo();

    void anotherfoo() {System.out.println(I am not a abstract method);

    }

    The above example sho%s that an abstract class can have some implemented methods inaddition to abstract methods+

    o% %hat about the belo% code!

    http://extreme-java.blogspot.com/2008/07/abstract-classes-in-java.htmlhttp://extreme-java.blogspot.com/search/label/abstract%20classeshttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/SCJPhttp://extreme-java.blogspot.com/search/label/SCJP%201.4http://extreme-java.blogspot.com/2008/07/abstract-classes-in-java.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/abstract-classes-in-java.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=5825681682880991062&from=pencilhttp://extreme-java.blogspot.com/2008/07/abstract-classes-in-java.htmlhttp://extreme-java.blogspot.com/search/label/abstract%20classeshttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/SCJPhttp://extreme-java.blogspot.com/search/label/SCJP%201.4http://extreme-java.blogspot.com/2008/07/abstract-classes-in-java.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    12/44

    abstract class Mynotherfoo e!tends Myfoo {

    void "ron#$oo {System.out.println(%his is "ron#);

    }

    }

    The compiler %ill be more than happy in the above case because of the marer abstractbefore the class+ 7ad the class not been declared as abstract6 the compiler %ould haveflashed an error unless an implementation of the abstract method foo) has not be &ivenin the subclass+

    >s far as desi&n is concerned6 the abstract classes are provided so that some common&uidelines can be provided to the subclasses+ 5or e+&+ a class named as 5i&ure %ill havean abstract method as!

    abstract void set&olor();

    %hich %ill mae sure that S0uare6 9ectan&le and Trian&le %hich extend the 5i&ure class%ill have to provide a method body for the above method+

    8ne more implication of abstract classes is that since abstract classes are meant to beextended6 so they canMt be instantiated+ 7o%ever a reference can be declared and isdeclared 0uite often in %ell desi&ned application+ 5or e+& in the 5i&ure class above6 areference to 5i&ure class can hold obHects of type S0uare6 9ectan&le and Trian&le andhence provides more usability+

    Please note that final and abstract are mutually exclusive+

    The point to be taen home from the above discussion is that declare classes as abstract%here &enerality is implicit and more concrete implementations for this &enerality follo%+

    2ifference between String and String3uffer

    P1ST&2 3Y S,42&&P

    /,3&/S: SCJP' ST+"40 ,42 ST+"403.&+' ST+"40 5S ST+"403.&+

    6 C1MM&4TS

    The Strin& class is final and Strin& obHects are immutable %hich means that the value ofStrin& obHects canMt be modified+$ut there are situations %here one needs to modify the underlyin& Strin& text+ To solvethis problem6 Hava has Strin&$uffer class %hose obHects are mutable and can be modifiedusin& the methods+ This means that instead of returnin& a ne% obHect as in case of Strin&class6 the methods of Strin&$uffer class return the modified obHect+

    http://extreme-java.blogspot.com/2008/07/difference-between-string-and.htmlhttp://extreme-java.blogspot.com/search/label/SCJPhttp://extreme-java.blogspot.com/search/label/String%20and%20StringBufferhttp://extreme-java.blogspot.com/search/label/String%20vs%20StringBufferhttp://extreme-java.blogspot.com/2008/07/difference-between-string-and.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=9066824979039549791&from=pencilhttp://extreme-java.blogspot.com/2008/07/difference-between-string-and.htmlhttp://extreme-java.blogspot.com/search/label/SCJPhttp://extreme-java.blogspot.com/search/label/String%20and%20StringBufferhttp://extreme-java.blogspot.com/search/label/String%20vs%20StringBufferhttp://extreme-java.blogspot.com/2008/07/difference-between-string-and.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    13/44

    8ther thin& to note about Strin&$uffer class is that the methods are synchroni?ed+Strin&$uilder is another class %hose obHects are mutable but its methods are notsynchroni?ed+

    5or the SCJP exam6 it is crucial to no% that Stri&$uffer class has constructor %hich canaccept an obHect of type Strin& but the reverse is not true+,oreover6 the Strin& and Strin&$uffer obHects are never e0ual to each other even if theunderlyin& text is same for both+

    Strings in Ja$a

    P1ST&2 3Y S,42&&P 14 J./ 8E' (669

    /,3&/S: /Y)&"0HT 2&S"04 P,TT&+4' J,5,' ST+"40 /"T&+,/S'

    ST+"40S' ST+"40S "4 J,5,6 C1MM&4TS

    The Strin& type is so %idely used that Java treats its values as literals %ithin double0uotes+ $ut internally6 the Strin&s are stored as 8bHects+ Since they are so %idely used6there is a dan&er that a Strin& %ritten by somebody may be over%ritten by otherserroneously+ To avoid such ind of situation6 the Strin& class has been made final %hichmeans that no class can extend Strin& class so as to modify the operations %hich aremeant to be standard for all users@pro&rammers+ ,oreover6 the Strin& obHects areimmutable %hich means that the Strin& classMs methods donMt modify the Strin& obHect on%hich the method is invoed+

  • 8/12/2019 Tips to Clear SCJP Exam

    14/44

    Strin# b ' Strin#;

    a '' *

    The ans%er to above 0uestion is true because the both a and b point to the same Strin&

    obHect present in the Strin& literal pool and this is also no%n as fly%ei&ht desi&n pattern+

    1$erloading rules in Ja$a

    P1ST&2 3Y S,42&&P 14 J./ 8D' (669

    /,3&/S: J,5,'15&+/1,2"40'15&+/1,2"40 +./&S "4 J,5,6

    C1MM&4TS

    etAs 0uicly define overloadin& in a basic %ay!

    1$erloading is using the same method name but different number?t!pe?orderparameters %

    Case1!> method named fix) is defined in a class as!void fi!() {System.out.println(+fi!,,no parameters+);

    }

    This method can be overloaded6 if a method %ith name fix) is defined in the same classbut %ith different parameters as!void fi!(int t) {

    System.out.println(+fi!,,one parameters+);}

    The compiler %ill not flash any error in the above case+> method call as fix2) %ill print Bbfix**one parametersB@b on console$ut a method call as fix) %ill print Bbfix**no parametersB@b on console

    Case2!Consider the overloaded methods defined as!void fi!(int t) {System.out.println(+fi!,,one int parameters+);

    }

    void fi!(lon# t) {

    System.out.println(+fi!,,one lon# parameters+);

    http://extreme-java.blogspot.com/2008/07/overloading-rules-in-java.htmlhttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/overloadinghttp://extreme-java.blogspot.com/search/label/overloadinghttp://extreme-java.blogspot.com/search/label/Overloading%20rules%20in%20Javahttp://extreme-java.blogspot.com/search/label/Overloading%20rules%20in%20Javahttp://extreme-java.blogspot.com/2008/07/overloading-rules-in-java.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/overloading-rules-in-java.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=7879737657207924502&from=pencilhttp://extreme-java.blogspot.com/2008/07/overloading-rules-in-java.htmlhttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/overloadinghttp://extreme-java.blogspot.com/search/label/Overloading%20rules%20in%20Javahttp://extreme-java.blogspot.com/2008/07/overloading-rules-in-java.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/overloading-rules-in-java.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    15/44

    }

    Guess %hat %ill the call fix2) do+ es the int parameteri?ed function %ill be called+

    Case3!

    Consider the methods in case2 redefined as!int fi!(lon# t) {System.out.println(+fi!,,one int parameters+);

    return -;}

    void fi!(lon# t) {

    System.out.println(+fi!,,one lon# parameters+);}

    The above methods are not overloaded because return types donAt matter+ The compiler

    %ill flash an error in this case+

    Case'!Consider the methods in case2 redefined as!void fi!(lon# t) thro"s I/!ception{

    System.out.println(+fi!,,one int parameters+);return -;

    }

    void fi!(lon# t) thro"s S01/!ception{

    System.out.println(+fi!,,one lon# parameters+);

    }

    The above methods are a&ain not overloaded as exception declarations also donAt matter%hile overloadin&+

    Case(!Consider the fix methods defined as in Case2 abovevoid fi!(int t) {

    System.out.println(+fi!,,one int parameters+);

    return -;}

    void fi!(lon# t) {System.out.println(+fi!,,one lon# parameters+);

    }

  • 8/12/2019 Tips to Clear SCJP Exam

    16/44

    and method call aschar ch'-;

    s.fi!(ch);

    7ere ch %ill be implicitly typecasted to match method+ The castin& %ill be done to a

    minimum %ider types of those available in the method call+ Thus in this case void fixintt) %ill be called+

    Case-!void fi!(int tlon# u) {

    System.out.println(+fi!,,one int parameters+);

    return -;

    }

    void fi!(int tfloat u) {

    System.out.println(+fi!,,one lon# parameters+);

    }> method call fix262) in this case %ill %or but a method call fix262+) %onAt %orbecause the second ar&ument type double canAt be typecasted to float or lon&+ Thus it isthe method calls that determine the ambi&uity of the overloaded methods+

    o% an interestin& case+ Suppose there is a class $inarySearch %hich has its constructordeclared as2inarySearch() { 33some code }otice that constructors donAt have any return type+o% declare a method as!

    int 2inarySearch() {33some code }

    > method call for the instance bs of class $inarySearch as bs+$inarySearch) %ill not callthe constructor+

  • 8/12/2019 Tips to Clear SCJP Exam

    17/44

    obHects of its type only+The comparator should be used %hen some external class is tain& your class as aparameter for some comparison operation and it doesnAt no% ho% to compare the obHectsand expects you to &ive it+

  • 8/12/2019 Tips to Clear SCJP Exam

    18/44

    public class %est

    {

    public static void main(Strin#56 ar#s)

    {

    Strin# str7 ' +bar+;

    Strin# str- ' +barfoo+;

    int compare8esult ' str7.compare%o(str-);

    if (compare8esult 9 :){ System.out.println(str7 +is less than+ str-); }else if (result'' :){ System.out.println(str7 +is eual to+ str-); }else{ System.out.println(str7 +is

    #reater than+ str-); } } }

  • 8/12/2019 Tips to Clear SCJP Exam

    19/44

    class %est{

    private int prop7;

    public void set=rop7(int prop7){

    this.prop7'prop7;

    }

    public int #et=rop7(){

    return this.prop7;

    }

    }

    class %est&omparator implements &omparator{

    public int compare(b4ect ob47 b4ect ob4-){

    int test7 ' ( (%est) ob47).#et=rop7();

    int test- ' ( (%est) ob4-).#et=rop7();

    if( test7 > test- )

    return 7;

    else if( test7 9 test- ) return ,7; else return :; } }

    So %hats the distin&uishin& part bet%een the comparable and comparator;ell its the difference in terms of the method si&nature at code level+$ut in terms of desi&n level6 there is a bi& difference and should not be overlooed+

    The comparable interface shouldbe used %hen the current obHect is to be compared toobHects of its type only+The comparator should be used %hen some external class is tain& your class as aparameter for some comparison operation and it doesnAt no% ho% to compare the obHectsand expects you to &ive it+

  • 8/12/2019 Tips to Clear SCJP Exam

    20/44

    Comparable Prray

  • 8/12/2019 Tips to Clear SCJP Exam

    24/44

    Go to ;indo%VVPreferencesVV>ntVV9untimeVVClasspathVV>nt 7ome /ntries and addthese 2 /xternal J>9s Clic to &et them)!

    xercesPutoboxin& etc+)

    /xams Guide SCJP moc exam for all versions of SCJP)

    Sahir Shah moc tests applet for all versions of SCJP)

    :aloxo for all versions of SCJP)

    anchisholm for all versions of SCJP)

    JC7= moc exam 1

    JC7= moc exam 2

    http://www.findjar.com/index.jsp?query=xercesimplhttp://www.findjar.com/index.jsp?query=xmlParserapishttp://extreme-java.blogspot.com/2008/07/scjp-mock-exam-links.htmlhttp://extreme-java.blogspot.com/search/label/SCJP%201.4%20brain%20dumpshttp://extreme-java.blogspot.com/search/label/SCJP%201.4%20mock%20examhttp://extreme-java.blogspot.com/search/label/SCJP%201.4%20mock%20examhttp://extreme-java.blogspot.com/search/label/SCJP%20linkshttp://extreme-java.blogspot.com/search/label/SCJP%20linkshttp://extreme-java.blogspot.com/2008/07/scjp-mock-exam-links.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/scjp-mock-exam-links.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/scjp-mock-exam-links.html#disqus_threadhttp://www.javaprepare.com/quests/test.htmlhttp://www.javaprepare.com/quests/test.htmlhttp://www.examulator.com/phezam/question.phphttp://www.examlab.tk/http://www.javabeat.net/products/cert/scjp-1-5.phphttp://examsguide.com/scjp/freequestions.htmlhttp://www.geocities.com/sahirshah/applets/mocktest.htmlhttp://www.valoxo.ch/jr/mocks/mock01a.htmlhttp://www.danchisholm.net/oct1/mybook/index.htmlhttp://www.jchq.net/mockexams/exam1.htmhttp://www.jchq.net/mockexams/exam2.htmhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=3261163312171576406&from=pencilhttp://www.findjar.com/index.jsp?query=xercesimplhttp://www.findjar.com/index.jsp?query=xmlParserapishttp://extreme-java.blogspot.com/2008/07/scjp-mock-exam-links.htmlhttp://extreme-java.blogspot.com/search/label/SCJP%201.4%20brain%20dumpshttp://extreme-java.blogspot.com/search/label/SCJP%201.4%20mock%20examhttp://extreme-java.blogspot.com/search/label/SCJP%20linkshttp://extreme-java.blogspot.com/2008/07/scjp-mock-exam-links.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/scjp-mock-exam-links.html#disqus_threadhttp://www.javaprepare.com/quests/test.htmlhttp://www.javaprepare.com/quests/test.htmlhttp://www.examulator.com/phezam/question.phphttp://www.examlab.tk/http://www.javabeat.net/products/cert/scjp-1-5.phphttp://examsguide.com/scjp/freequestions.htmlhttp://www.geocities.com/sahirshah/applets/mocktest.htmlhttp://www.valoxo.ch/jr/mocks/mock01a.htmlhttp://www.danchisholm.net/oct1/mybook/index.htmlhttp://www.jchq.net/mockexams/exam1.htmhttp://www.jchq.net/mockexams/exam2.htm
  • 8/12/2019 Tips to Clear SCJP Exam

    25/44

    JC7= moc exam 3

    >n&elfire for all versions of SCJP)

    lan% for all versions of SCJP)

    JavaCertificate for all versions of SCJP)

    smaHHi moc exams for all versions of SCJP)

    Javaranch online moc exams for all versions of SCJP)

    Coffee %ith Hava for all versions of SCJP)

    Tests%orld &eneral Hava test)

    /inks for SCJP 8%D stud! notes

    P1ST&2 3Y S,42&&P

    /,3&/S: SCJP 8%D' SCJP 8%D ST.2Y 41T&S6 C1MM&4TS

    http!@@%%%+Hch0+net@tutorial@'K1Tut+htmhttp!@@%%%+Havadeveloper+co+in@scHp@scHp*notes+htmlhttp!@@%%%+michael*thomas+com@tech@Hava@index+htmlhttp!@@%%%+freeHava&uide+comhttp!@@Hava+boot+by@scHp*ti&er@http!@@%%%+Havacertificationexams+com@scHp*study*&uides+phphttp!@@%%%+Havacertificationexams+com@scHp*community+php

    SCJP 8%E "?1

    P1ST&2 3Y S,42&&P 14 J./ B' (669

    /,3&/S: J,5,'J,5, "?1' +&,2&+'SCJP 8%E' )+"T&+ C/,SS&S6

    C1MM&4TS

    The exam says you need to no% the %riter classes6 Seriali?ation and desi&n patternbein& used in implementin&

  • 8/12/2019 Tips to Clear SCJP Exam

    26/44

    The 5ile;riter class has limited use as it doesnAt have any buffer+

    Similar heirarchy exists in 9eader classes %ith 9eader class bein& the abstract class and5ile9eader corresponds to 5ile;riter of ;riter heirarchy+

    $esides this6 one also needs to no% the desi&n pattern

    SCJP 8%D Stud! 4otes7 Part7(

    P1ST&2 3Y S,42&&P 14 J./ D' (669

    /,3&/S: J,5,'SCJP' SCJP 8%D' SCJP 8%D ST.2Y 41T&S6 C1MM&4TS

    )Superclass n abstract class can implement an interface+1() >n abstract class can extend other classes+1-) >n abstract class can have final methods+1.) static final variable can be a member variable and needs special treatment than that%ithout static ey%ord+ Since it is static6 the initiali?ation in constructor may not %or+

  • 8/12/2019 Tips to Clear SCJP Exam

    27/44

    initiali?ation can be in a static bloc or %hen declarin& the variable+ 8nce done that itbecomes definitely assi&ned and hence canMt be reassi&ned+ ,oreover a final &lobalvariable must be assi&ned %hile a final local variable may not be+1)

  • 8/12/2019 Tips to Clear SCJP Exam

    28/44

    2.) /ven the order of ar&uments matters %hen overridin& a method+2) 8bHect reference and local variables are stored on stac+ S a relationship is composition 8ne class has an obHect of other as itsmember)

    SCJP 8%D Stud! 4otes7 Part78

    P1ST&2 3Y S,42&&P

    /,3&/S: SCJP' SCJP 8%D' SCJP 8%D ST.2Y 41T&S6 C1MM&4TS

    1) 9eturn type and method name al%ays &o to&ether2) ative method declarations have no body3) > top*level class can be public6 abstract@final6 strictfp+') > top*level interface can be public6 abstract6 strictfp+ abstract is implied by default+()

  • 8/12/2019 Tips to Clear SCJP Exam

    29/44

    11) Code to create database connection6 execute statement and process results is!Class+forameLsun+Hdbc+odbc+Jdbc8dbcriverL)Connection con D river,ana&er+&etConnectionLHdbc!odbc!atabaseL6LaL6LbL)Statement stmt D con+createStatement)9esultSet set D stmt+execute=ueryLSelect W from abcL)

    %hileset+next)) E

    F12) The Strin& class is a final class+13) 5inal classes improve performance as the methods are expanded inline+1') >ll the methods of final class are also final as the class canMt be subclassed and hencethe methods canMt be overridden+1() volatile and transient can only be applied to member variables+1-) volatile and final canMt &o to&ether+1.) transient maes member variables non*persist able %hile seriali?in& the obHect+1) volatile variables maintain a master copy in addition to the local copy of each thread

    and each thread has to eep its local copy in sync %ith the &lobal copy+ These variablesare useful to avoid concurrency problem %hen synchroni?ation is not an option+ They areslo%er+14) To avoid havin& different people usin& the same paca&e name6 Sun recommendsusin& the reverse of the internet domain as paca&e name+ e+& com+sun+Hava2) abstract and final are mutually exclusive21) >ll Hava classes must extend a superclass+22) Thou&h classes can be built %ithout inheritance and interfaces6 but that desi&n %ill bepoor+23) >ll variables in an interface are public static final by default and all methods arepublic abstract by default+ public because compiler no%s that interface by itself isabstract and somebody needs to implement it6 so even if public is omitted the methodsand variables are public by default+2') ,ethod access modifiers! public6 private6 protected or none default),ethod special modifiers! abstract6 final6 static6 synchroni?ed6 native;hen abstract is used for a method then final6 synchroni?ed6 strictfp6 static and nativecanMt be used+2() Constructor facts!a+ The return type is implicitly this6 but this value canMt be collected usin& assi&nmentoperatorb+ Constructor canMt be inherited as other superclass methodsc+ The constructor canMt be final6 abstract6 synchroni?ed6 native6 static special modifiers)2-) s main method is declared static6 it canMt use non*static variables declared in thesame class+2) 8nly a constructor can invoe another constructor and that call must be the firststatement of the callin& constructor+ this) or super))24) super) is usually used to call parameteri?ed superclassM constructor+

  • 8/12/2019 Tips to Clear SCJP Exam

    30/44

    error because compiler automatically inserts a call to no*ar&ument constructor+3) Constructor chainin& is the callin& of superclass constructor all throu&h the hierarchy+

    How to code in ;S/

    P1ST&2 3Y S,42&&P

    /,3&/S: +&P1+TS .S"40 ;S/';S/' ;S/T6 C1MM&4TS

    7ereAs a document to up&rade your QST sills+ ll pa&es %ill submit to the same controller and thecontroller based on %hat is return from the vie%6 calls the correspondin& dispatcher+ The

    dispatcher on completin& its process for%ards to appropriate vie%+ The vie% mappin&smay be stored some%here or may be hardcoded %ithin& the dispatcher+

    8ne %ay the vie% can send the event fired by user to the controller is by the use of JSP%hich %ill add a parameter into the re0uest obHect+ $ut this %ill unnecessarily complicatethe thin&s+ >nother approach is to use some hidden field %hich %ill automaticall includedin the re0uest and %hose value can be set usin& Havascript dependin& upon the event firedby the user+

    7ere is some code to demonstrate this+

    http://extreme-java.blogspot.com/2008/07/how-to-code-in-xsl.htmlhttp://extreme-java.blogspot.com/search/label/Reports%20using%20XSLhttp://extreme-java.blogspot.com/search/label/XSLhttp://extreme-java.blogspot.com/search/label/XSLhttp://extreme-java.blogspot.com/search/label/XSLThttp://extreme-java.blogspot.com/2008/07/how-to-code-in-xsl.html#disqus_threadhttp://javacentre.f-sw.com/tutorials/xslt/xslt.dochttp://javacentre.f-sw.com/tutorials/xslt/xslt.dochttp://extreme-java.blogspot.com/2008/07/how-to-design-mvc-architeture.htmlhttp://extreme-java.blogspot.com/search/label/custome%20MVChttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/JSPhttp://extreme-java.blogspot.com/search/label/MVChttp://extreme-java.blogspot.com/search/label/request%20objecthttp://extreme-java.blogspot.com/search/label/request%20objecthttp://extreme-java.blogspot.com/2008/07/how-to-design-mvc-architeture.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/how-to-design-mvc-architeture.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=4766752926335667390&from=pencilhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=876682150074162803&from=pencilhttp://extreme-java.blogspot.com/2008/07/how-to-code-in-xsl.htmlhttp://extreme-java.blogspot.com/search/label/Reports%20using%20XSLhttp://extreme-java.blogspot.com/search/label/XSLhttp://extreme-java.blogspot.com/search/label/XSLThttp://extreme-java.blogspot.com/2008/07/how-to-code-in-xsl.html#disqus_threadhttp://javacentre.f-sw.com/tutorials/xslt/xslt.dochttp://extreme-java.blogspot.com/2008/07/how-to-design-mvc-architeture.htmlhttp://extreme-java.blogspot.com/search/label/custome%20MVChttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/JSPhttp://extreme-java.blogspot.com/search/label/MVChttp://extreme-java.blogspot.com/search/label/request%20objecthttp://extreme-java.blogspot.com/2008/07/how-to-design-mvc-architeture.html#disqus_threadhttp://extreme-java.blogspot.com/2008/07/how-to-design-mvc-architeture.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    31/44

    o% the 5rontController %ill do somethin& lie this

    ;S/T Process

    P1ST&2 3Y S,42&&P 14 J./ >' (669

    /,3&/S: ;S/T P+1C&SS6 C1MM&4TS

    7ere is the process to &enerate the output txt6pdf6sc&6csv etc+) usin& xml6 xsl and xsltprocessor+

    1) Get the Q, containin& the data+2) ecide on the layout of output+3) ;rite the QS file') 9un the QST processor to &enerate the output document+

    http://extreme-java.blogspot.com/2008/07/xslt-process.htmlhttp://extreme-java.blogspot.com/search/label/XSLT%20processhttp://extreme-java.blogspot.com/2008/07/xslt-process.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=1287176580327960738&from=pencilhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=7616512021447982135&from=pencilhttp://bp1.blogger.com/_2BglUQm2ZIA/SG2mzAgK8rI/AAAAAAAAAB8/caJtveH76sQ/s1600-h/dispatcher.JPGhttp://bp3.blogger.com/_2BglUQm2ZIA/SG2mWV_jyOI/AAAAAAAAAB0/si9FzfK38NE/s1600-h/html.JPGhttp://extreme-java.blogspot.com/2008/07/xslt-process.htmlhttp://extreme-java.blogspot.com/search/label/XSLT%20processhttp://extreme-java.blogspot.com/2008/07/xslt-process.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    32/44

    SCJP 8%E or 8%D

    P1ST&2 3Y S,42&&P

    /,3&/S: SCJP 8%D 1+ 8%E' SC)C2' S.4 M"C+1SYST&MS6 C1MM&4TS

    < %as in the dilema that should < &o for SCJP 1+' or scHp 1+( certification+ $ut no% < have

    decided that < %ill &o for scHp 1+( because that much improved and %ill &ive much betterappeal to C: than 1+' version+

    ,oreover6 as it stands out that SI ,icrosystems may %ithdra% 1+' version certificationby the time < appear for the exam+1+( is &oin& to stay and thats for sure+

    > random thou&ht that SC;C exam is 1+( no% and not 1+'+ So SCJP 1+( and SC;C1+( mae better combination than SCJP 1+' and SC;C 1+(

    enums in =a$a

    P1ST&2 3Y S,42&&P 14 J.4 89' (669

    6 C1MM&4TS

    static canAt be applied to method local classes but can be applied to inner classes+************************************************************************************

    semicolon at the end of enums is optionalenums can be a class outside the non*inner public class or a memeber of some class but

    not that of a function

    the enum values are constant

    enums can have constructors+ enums can have instance variables and enums can havefunctions

    a sin&le enum value can have content specific body %hich can &ive some particularbehavious only for that enum constant+

  • 8/12/2019 Tips to Clear SCJP Exam

    33/44

    P1ST&2 3Y S,42&&P 14 J.4 8B' (669

    6 C1MM&4TS

    ' (669

    6 C1MM&4TS

    The second volume of Technical Journal in my or&ani?ation is out and the much a%aiteddonAt no% by ho% many people !) ) article &ot published+ ll the methods of final class are also final+() Transient ey%ord can only be applied to member variables and it maes thosevariable non*persistable %hile seriali?in& the obHect+-) Java interfaces cannot have transient variables+.) :olatile variables maintain a master copy in addition to the local copy of each threadand each thread has to eep its copy in sync %ith the local copy+ They are useful to avoid

    http://extreme-java.blogspot.com/2008/06/interfaces-in-java-are-more-of-contract.html#disqus_threadhttp://extreme-java.blogspot.com/2008/06/published-article-on-jquery.htmlhttp://extreme-java.blogspot.com/2008/06/published-article-on-jquery.html#disqus_threadhttp://extreme-java.blogspot.com/2007/12/java-access-modifiers.htmlhttp://extreme-java.blogspot.com/search/label/java%20access%20modifiershttp://extreme-java.blogspot.com/2007/12/java-access-modifiers.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=1267854733161158196&from=pencilhttp://extreme-java.blogspot.com/2008/06/interfaces-in-java-are-more-of-contract.html#disqus_threadhttp://extreme-java.blogspot.com/2008/06/published-article-on-jquery.htmlhttp://extreme-java.blogspot.com/2008/06/published-article-on-jquery.html#disqus_threadhttp://extreme-java.blogspot.com/2007/12/java-access-modifiers.htmlhttp://extreme-java.blogspot.com/search/label/java%20access%20modifiershttp://extreme-java.blogspot.com/2007/12/java-access-modifiers.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    34/44

    concurrency problem %hen synchroni?ation is not an option+ They are some%hat slo%er+) The only modifier that can be applied to local variables in final+

    You might also like:

    evelop Java // ;eb Services %ith /clipse6 >Qpplication

    7o% to rrayist in Struts2

    /ink)ithin

    2ifference between Hashmap and Hashtable

    P1ST&2 3Y S,42&&P

    /,3&/S: H,SHM,P' H,SHT,3/&'J,5,6 C1MM&4TS

    1) 7ashtable and 7ashmap are different in the sense that 7ashmap is synchroni?ed andpermits nulls as eys as %ell as values+ 7ashtable re0uires non*null values for eys as%ell as values+a+ value of +.( forload factor is &ood tradeoff bet%een time and space cost+c+ The expected number of entries in the map and its load factor should be taen intoaccount %hen settin& its initial capacity6 so as to minimi?e the number of rehashoperations+

  • 8/12/2019 Tips to Clear SCJP Exam

    35/44

    h+ Similar is the case %ith &et)6 it returns null if either there is no ey %ith namespecified or the ey explicitly maps to null+ The contains"ey can be used to distin&uishthese t%o cases+You might also like:

    ,y ist of Top 2 Java 9elated $oos

    Sho%in& Generic /rror Pa&e in Struts2 ;eb >pplication

    7o% to rrayist in Struts2

    evelop Java // ;eb Services %ith /clipse6 >Q

  • 8/12/2019 Tips to Clear SCJP Exam

    36/44

  • 8/12/2019 Tips to Clear SCJP Exam

    37/44

    () our life becomes much easier+

    7o% to achieve it!1) Create a class to maintain the threadpool information lie the read and runnin& 0ueues6the variables for max and min number of threads6 time to eep a thread alive

    2) > class %hich contains the loop to chec for threads in the runnin& and ready 0ueuesand mae a decision %hether to invoe a particular thread or not+You might also like:

    Sho%in& Generic /rror Pa&e in Struts2 ;eb >pplication

    Java :erbose 8ptions for 9unnin& Pro&rams

    9/ST ;eb Service ' (66B

    /,3&/S: ,// T"PS' J,5,' J23C' SCJP6 C1MM&4TS

    1) There are three levels of J$C >P:> 2+ and supports connection poolin&6distributed tansactions4) atasource uses J< to find the datasource on the server and bind itself to it+1) The context interface provides the facility to loo up6 bind and unbind the datasource11) The J$C url has three parts! Hdbc!!12) The Statement obHect can be used to pass the S= commands to the databasecon+createStatement))13) The prepared statement can be passed parameters and hence can be used %ithdifferent values and is usually faster than statement+ con+prepareStatement)1') The callable statement can be used to call stored procedures+ con+prepareCall)1() The different versions for execute method are!a+ executeIpdateStrin& s0l) X Statements %hich return a count

    http://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.htmlhttp://extreme-java.blogspot.com/2011/05/rest-web-service-interview-questions.htmlhttp://extreme-java.blogspot.com/2011/04/how-to-send-http-post-request-in-java.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2007/12/all-java-jdbc-tips.htmlhttp://extreme-java.blogspot.com/search/label/all%20tipshttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/jdbchttp://extreme-java.blogspot.com/search/label/SCJPhttp://extreme-java.blogspot.com/2007/12/all-java-jdbc-tips.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=8806710309287397158&from=pencilhttp://extreme-java.blogspot.com/2011/05/showing-generic-error-page-in-struts2.htmlhttp://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.htmlhttp://extreme-java.blogspot.com/2011/05/rest-web-service-interview-questions.htmlhttp://extreme-java.blogspot.com/2011/04/how-to-send-http-post-request-in-java.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2007/12/all-java-jdbc-tips.htmlhttp://extreme-java.blogspot.com/search/label/all%20tipshttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/jdbchttp://extreme-java.blogspot.com/search/label/SCJPhttp://extreme-java.blogspot.com/2007/12/all-java-jdbc-tips.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    38/44

    b+ execute=ueryStrin& s0l) X Statements %hich return a sin&le resultsetc+ executeStrin& s0l) X Statements %hich return multiple resultsets >dvanced 5unda)1-) ;hile usin& the statement obHect6 the 0uery is passed %hen it is executed1.) ;hen usin& prepared statement6 the 0uery is passed %hen creatin& the statementobHect from connection obHect+ This helps in pre*compilation

    1) The callable statement also passes the call statement %hile creatin& the statementobHect from the connection obHect+14) Callable statement extends prepared statement2) Callable statement can also tae output parameters too+ $ut that parameter must bere&istered usin& re&ister8utParameter) method before callin& the execute method+ /+&callstmt+re&ister8utParameter36 Hava+s0l+Types+:>9C7>9) if the third parameter issupposed to be the 8IT parameter+21) The commit occurs %hen the statement completes or the next execute occurs6%hichever comes first+

  • 8/12/2019 Tips to Clear SCJP Exam

    39/44

    7o% to!) Ise of enums in classes

    You might also like:

    9/ST ;eb Service Q

  • 8/12/2019 Tips to Clear SCJP Exam

    40/44

  • 8/12/2019 Tips to Clear SCJP Exam

    41/44

    array obHect thatMs bein& &iven memory in heap and each member of array obHect is oftype byte+1) len&th is a property of array and not a method11) >s Hava+lan&+8bHect is the superclass of an array6 arrays understand all method callsof Hava+lan&+8bHect class+

    You might also like:

    evelop Java // ;eb Services %ith /clipse6 >QQK:>I/char X 1-bits ** to 21-*1) or YUuM to YUu5555Mboolean X 1bit X true or false) The numbers havin& decimal point are double by default and canMt be assi&ned to floatvariables %ithout explicit castin&+ because float is narro%er than double)4) > value %ill be interpreted as non*inte&er if either it has decimal point or the letter e or/ denotin& the exponent)

    1) >ll Hava ey%ords are al%ays in a lo%er case2) Some hard to remember ey%ords are const &oto strictfp and volatile

    http://extreme-java.blogspot.com/2011/02/develop-java-ee-web-services-with.htmlhttp://extreme-java.blogspot.com/2011/05/how-to-iterate-arraylist-in-struts2.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/05/rest-web-service-interview-questions.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2007/12/identifierskeywords-and-literals.htmlhttp://extreme-java.blogspot.com/search/label/Identifiershttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/keywordshttp://extreme-java.blogspot.com/search/label/keywordshttp://extreme-java.blogspot.com/search/label/literalshttp://extreme-java.blogspot.com/2007/12/identifierskeywords-and-literals.html#disqus_threadhttp://extreme-java.blogspot.com/2007/12/identifierskeywords-and-literals.html#disqus_threadhttp://www.blogger.com/post-edit.g?blogID=2723424032685314284&postID=1834352747399844101&from=pencilhttp://extreme-java.blogspot.com/2011/02/develop-java-ee-web-services-with.htmlhttp://extreme-java.blogspot.com/2011/05/how-to-iterate-arraylist-in-struts2.htmlhttp://extreme-java.blogspot.com/2011/02/my-list-of-top-20-java-related-books.htmlhttp://extreme-java.blogspot.com/2011/05/rest-web-service-interview-questions.htmlhttp://www.linkwithin.com/learn?ref=widgethttp://extreme-java.blogspot.com/2007/12/identifierskeywords-and-literals.htmlhttp://extreme-java.blogspot.com/search/label/Identifiershttp://extreme-java.blogspot.com/search/label/Javahttp://extreme-java.blogspot.com/search/label/keywordshttp://extreme-java.blogspot.com/search/label/literalshttp://extreme-java.blogspot.com/2007/12/identifierskeywords-and-literals.html#disqus_thread
  • 8/12/2019 Tips to Clear SCJP Exam

    42/44

    3) *Z6K6[') K and [ are the only non*unicode characters that can start an identifier()

  • 8/12/2019 Tips to Clear SCJP Exam

    43/44

    evelop Java // ;eb Services %ith /clipse6 >Q

  • 8/12/2019 Tips to Clear SCJP Exam

    44/44

    The compiler error %hen you declare a public type but donMt name the file as publictypeMsname is! The public type name must be defined in its o%n file name+HavaYou might also like:

    7o% to rrayist in Struts2

    7o% to Send 7TTP P8ST 9e0uest in Java

    Java :erbose 8ptions for 9unnin& Pro&rams

    9/ST ;eb Service