Computer Knowledge

Java Core Classes and Threads

1,473 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. These variable are used to save an object into a file.

  2. The thread will read the most recent updated value by using volatile variable.

  3. It is used to create variables and methods that will exist independently of any instances created for the class.

  4. Volatile variables are used in asynchronous medium.

  5. Both (2) and (4)

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

.

Multiple choice
  1. Starting to waitGoes an infinite wait and deadlock

  2. Starting to waitException found

  3. Starting to waitDone waiting, returning back

  4. Starting to waitInterruptedException Found

  5. None of these

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

Correct choice The wait() method calls without lock so it causes IllegalMonitorStateException, which catch block finds Exception.

Multiple choice
  1. Cannot call super class constructor Call to the super must be first in the constructor.

  2. 000455

  3. 000005

  4. 000450

  5. 000000

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

super(*) keyword should be the first line constructor, in which it is defined.