Whizlabs offers SCJP 6.0 Exam Simulator with 420 questions as per the SCJP 6.0 certification exam. Following are couple of sample SCJP Questions.

Topic: Flow Control

SCJP Question statement: What is the result of compiling and running the given code?

class A
{
     int b=10;
     private A()
     {
          this.b=7;
     }
     int f()
     {
          return b;
     }
}
class B extends A{ int b; }
class Test
{
     public static void main(String[] args)
     {
          A a=new B();
           System.out.println(a.f());
     }
}

Choices:

  1. Does not compile
  2. Prints 0
  3. Prints 10
  4. Prints 7





Click here for correct answer and explaination

Correct Answer: A

Explaination:

Choice A is the correct answer.

The code does not compile because the constructor of class A is declared as private. This creates a problem when the subclass constructor makes an implicit super() call to the parent class constructor at the time B is instantiated.

Since the code does not compile, all the other choices are incorrect. If the constructor of A had not been private, the output would have been 7.


Topic: Collections/Generics

SCJP Question statement: Which of these will compile and run? Select two choices.

Choices:

  1. LinkedList<Integer> l=new LinkedList<int>();
  2. List<Number> l=new LinkedList<Number>();
  3. LinkedList<Integer> l=new <Integer>LinkedList();
  4. List<Number> l=new LinkedList<Integer>();





Click here for correct answer and explaination

Correct Answer: B & C

Explaination:

Choices B and C are the correct answers.

The List interface is implemented by the LinkedList class. So List<Number> is the super type of LinkedList<Number>, which accepts only objects of type Number. LinkedList<Integer> declares a list that accepts only Integer objects. Assigning a LinkedList raw type to it gives warnings of unsafe operations, however, it does compile and run without errors.

Choice A is incorrect because generic parameters cannot be primitives.

Choice D is incorrect because the right hand side of the assignment uses the wrong syntax.

Reference:
http://java.sun.com/docs/books/tutorial/extra/generics/index.html

 


What's Next?
SCJP 6.0 Exam Simulator You can try out our 15 SCJP Questions Trial Test for FREE. Till now more than 19,000 participants have appeared in the trial exam . Try out the test and assess your rank compare to other test takers. This will help you to assess your strengths, weaknesses, speed and accuracy level in each Objective of SCJP 6 Certification Exam. If you are looking for more questions check out SCJP 1.6  Dumps. It has couple of interesting SCJP questions.




Customer Reviews

I have passed successfully SCJA (98%, one question lost only out of 51!) thanks to your software which actually helped my efforts in an unprecedented way

By Nikolaos "Nick" S. Bellias Read More....

I would like to take this opportunity to thank you for SCWCD preparation kit.
I have taken SCWCD exam and passed it with 84%.


By Lave Kulshreshtha Read More....

I definitely appreciate highly Whizlabs product as it gives the developers the opportunity to prepare for the real exam and get a real feeling about how the exam looks like and what it is all about. I managed to pass the exam with 86%, and in my opinion, the real questions were much easier than those from the Whizlabs tests. I would like Whizlabs to stay permanently in touch with Sun Microsystems in order to be able to deliver the right exam format. It seems that Sun tends to change it from time to time...

By Krum Bakalsky Read More....

Sending your message. Please wait...

Thanks for sending your message! We will get back to you shortly.

There was a problem sending your message. Please try again.

Please complete all the fields in the form before sending.