1 . Which of the following can prevent a thread from executing? A call to its pause method A call to Thread.yield() Another thread is given higher priority A call to its halt() method 2 . Which of the following represent correct syntax for assertions? assertion(b==false); assert (b==false); assert() b==false; if(b!=true) assert; 3 . What …
OCPJP 6 Mock Exam -14
1 . Given Answer class behaves like some a File it has a Vector, a color, some boolean variable.What is the correct declaration? import public private Vector Serializable File Color extends boolean implements 2 . Some design issues: The following description applies to a class: given someclassname behaves as somesuperclassname and it has some fields …
OCPJP 6 Mock Exam -13
1.What will be the output? Choose the one below: True False 2 . What will be the output? Choose the one below: True False 3 . What will be the output? Is the line marked “lots of code” ever reached? Yes No 4 . What will be the output? Choose the one below: The code …
OCPJP 6 Mock Exam -12
1 . What will be the output? Choose the one below: the code will compile an print “Equal”. the code will compile an print “Not Equal”. the code will cause a compiler error. 2 . What will be the output? Choose the one below: the code will compile an print “Equal”. the code will compile …
OCPJP 6 Mock Exam -11
1 . Consider following classes: What will be the output of running class Test? false false true false true false true true false true true true true true true true true true false true None of the above 2 . Any class may be unloaded when none of it’s instances and class objects that represent …
ArrayList in Java
ArrayList is most widely used collections API for storing the list of objects. This class is equivalent to Vector, except that it is unsynchronized. Look at the below important points about the class ArrayList. It allows null values It stores the duplicate elements The size of the list is grows dynamically when more elements are …
Difference Between Throw and Throws in Exception Handling
When you are working with exception handling in Java, use of throw and throws may confuse you if you not familiar with the exception handling. Both are important keywords used frequently used in handling the exceptions. Throw is used for explicitly throwing an exception. Throw attribute in method signature, is a hint to the compiler …
Try, Catch and Finally in Exception Handling
The basic procedure to handle the exception is to use the try-catch block. If you want to put any code that would cause a exception, then write that piece of code inside the try-catch block. If you expect multiple type of exceptions in the same block, then you can write more than one catch block …