Computer Knowledge

Java Core Classes and Threads

1,935 Questions

Java core classes and threads form the foundation of object oriented programming and are crucial for IT officer and programming exams. This includes concepts like string mutability, collections, and multithreading. Solve these questions to test your practical coding and theoretical knowledge.

String and StringBuffer classesThread execution methodsJava collections frameworkCharacter streams input outputVariable serialization rules

Java Core Classes and Threads Questions

Multiple choice
  1. ArithmeticException

  2. ClassNotFoundException

  3. IllegalAccessException

  4. NoSuchFieldException

  5. NoSuchMethodException

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Yes, it is an unchecked exception. An unchecked exception can not be handled at compile time but a checked exception can be handled at compile time.

Multiple choice
  1. It ensures that the access to a class is denied.

  2. It ensures that there is an attempt to create an object of an abstract class or interface.

  3. It ensures that one thread has been interrupted by another thread.

  4. It ensures that the particular class is not found.

  5. None of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

This is the correct choice. NoSuchFieldException ensures that the requested field does not exist.

Multiple choice
  1. This method is a final method that returns a runtime representation of the class of this object.

  2. This method returns a String representation of the object.

  3. This method compares two objects for equality.

  4. This method creates a clone of this object.

  5. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

This is true about getClass() method.

Multiple choice
  1. It returns the element on the top of the stack and remove it.

  2. It is used to push the element on the stack.

  3. It returns true if the stack is empty, otherwise returns false.

  4. There is no such method defined in Stack class.

  5. None of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

This is the correct choice as Object peek() method is used to return the element on the stack, but does not remove it.