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. The garbage collection can be decided by the user.

  2. The finalize() method is guaranteed to run once for the garbage collection.

  3. Garbage collection works for the automatic memory management.

  4. Both (1) and (2)

  5. Garbage collection is not used in java.

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

These are the correct statements about garbage collection in java.

Multiple choice
  1. These variables are used to save an object to 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

The volatile modifier always reconcile its own private copy of the variable with the master copy in memory.