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. setLocation(int ,int)

  2. setVisible(Boolean)

  3. setSize(int , int)

  4. setDefaultCloseOperation(int)

  5. Pack()

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

This function is not defined in the Frame class. This function is defined in JFrame class in Swings. So this method cannot be invoked using the object of Frame class. But can be invoked using the Object of JFrame class.This method specifies the operation when the frame is closed. So the following line would be false. Frame f1 = new frame();f1.setDefaultCloseOperation(int); So, this is the correct answer.

Multiple choice
  1. windowMoved()

  2. windowClosing()

  3. windowIconified()

  4. windowActivated()

  5. windowDeiconified()

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

If a class implements an interface, then it is necessary for that class to define body to all the methods defined in the interface it is implementing. But windowMoved() method is not present in windowListener interface. So, when a class will implement this interface this method need not be defined in the class. So, this option is correct.

Multiple choice
  1. IllegalArgumentException

  2. NullPointerException

  3. IOException

  4. IndexOutOfBoundException

  5. ArithmeticException

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

IOException is not a subclass of RuntimeException class, this class is a Subclass of Exception class. This exception is thrown when invalid inputs/outputs are given. So, this is the correct answer as this is not a subclass of RuntimeException class.

Multiple choice
  1. Garbage collection reduces the effect of memory management methods.

  2. The dealloc method can not be called during GC.

  3. The methods like copy and mutable copy messages, copy the value of the object in case GC is enabled.

  4. The final method can not be implemented if GC is enabled.

  5. Garbage collection is off by default.

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

One can implement the final method for some (though not all) of the same cases.

Multiple choice
  1. The release and retain of the methods are done automatically.

  2. The release and retain of the methods are done automatically as well as manually.

  3. There is low memory leak.

  4. Reference counting works in this approach.

  5. It uses the same reference counting system as (Manual Retain-Release) MRR.

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

This is false as the manually release and retain of the methods is not possible.

Multiple choice
  1. createLoweredBevelBorder()

  2. createRaisedBevelBorder()

  3. createBevelBorder(int, Color, Color)

  4. createMatteBorder(int, int, int, int, Color)

  5. createFilledBorder()

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

This is the correct choice because there is no method named createFiledBorder() in java. So, this answer is correct.