Tech Me More

To quench our thirst of sharing knowledge about our day to day experience & solution to techincal problems we face in our projects.

Advertise with us !
Send us an email at diehardtechy@gmail.com

Friday, June 13, 2014

10 OCJP questions to puzzle you

We are compiling 10 OCJP question with explanation for every question.
Use the basic java concept to answer all the below questions.


Question :1 

Explanation:

Choice B is correct.


When we compile above code we wont get any error as it is legal to write class in 

interface.


Question :2

Explanation:

Choice A is correct.


private members of a class can be accessed with in the class. According to this statement 

the inner class can also access the private member of a outer class


Question :3


Explanation:

Choice A is correct.


Arrays are objects because of which we will get true. InstanceOf can be used as variable 

so 10 will be printed


Question :4


Explanation:

Choice B is correct.


Creating File instance will not create a file, once we say createNewFile() with file instance 

then only a file will be created. so first f.exists() will give false and second f.exists() will 

give true

Question :5



Question :6

Explanation:

Choice C is correct.


Index based remove() method will return element at the specified position in this list.


Question :7


Explanation:

Choice A is correct.


Thread prioriy will have same priority as the priority of thread created it.

Question :8


Explanation:

Choice D is correct.


Character class don't have constructor which accepts String as argument.

Question :9



Question :10



You can check more questions on SCJP here.









No comments: