TIPS TO CRACK SCJP

1. THE BOOK:
The best reference for SCJP is Head First Java, 2nd Edition.
This books gives all the inside and out of java which is required for SCJP examination.


Caution
Herbert Schildt is a good book in general, but is not a good reference for SCJP and many of the texts in this book are not correct.
So in my opinion Head First Java, 2nd Edition is the Bible for SCJP.



2. SCJP DUMPS
SCJP Dumps are set of mock and previous year papers. Previous year questions are a must.
If one understands and masters all the questions, one can easily score in the range of 75 -100%.
These questions often get repeated and if one goes through the whole set, one is bound to get around 60-80% questions in the test from previous year papers.


3.TEST

First of all, make sure that you mark 'novice' in the survey taken by sun prior to the test(SCJP).
Don't ever mark 'intermediate' or 'expert' because the paper will become quite difficult and might be difficult to pass even.

Secondly, 'Drag and Drop Questions'- these questions have to be attempted very carefully.
Make sure you check before confirming your answer because after confirming if you try to check your answer,it gets refreshed, and your answers disappear.
So better technique is to try and check in the first attempt itself.

SCJP MOCK QUESTIONS - 2

Question 2

Given:
10. public class Bar {
11.static void foo(int...x) {
12. // insert code here
13. }
14. }
Which two code fragments, inserted independently at line 12, will allow
the class to compile? (Choose two.)
A. foreach(x) System.out.println(z);
B. for(int z : x) System.out.println(z);
C. while( x.hasNext()) System.out.println( x.next());
D. for( int i=0; i< x.length; i++ ) System.out.println(x[i]);


Answer: BD

Answer:


type... x is used in function arguments where type can be any data type
for example:
int... x


which can take variable arguments
for example a function named var having declarations

var(int... x)

we can pass var(1); , var(1,1); , var(1,2,3);

so it can take 1 to any number of integers as arguments


int... x here x is just like an array and we can iterate over its elements using simple and enhanced for loop

other options are invalid

foreach is a method which is not defined
And hasnext() is used to iterate over collections(sets,lists,maps)

Hence the answer is B,D