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 InetAddress class

  2. The ContentHandler class

  3. The URLStreamHandler class

  4. The RemoteStackVariable class

  5. ThreadDeathEvent()

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

This class in the java.net package is used to read a stream of data that is generated by a network connection and produce an object.

Multiple choice
  1. import java.lang.*;

  2. import java.io.*;

  3. import java.util.*;

  4. import java.awt.*;

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

The Scanner class is in java.util package, which is imported with import java.util.*. Option A incorrectly imports java.lang (auto-imported), Option B imports java.io for I/O operations, and Option D imports java.awt for GUI components. Scanner is specifically a utility class for text parsing.

Multiple choice
  1. Math.random();

  2. getRandom();

  3. setRandom

  4. random();

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

Math.random() is the standard Java method that returns a double between 0.0 and 1.0. Option B (getRandom) doesn't exist in Java API. Option C (setRandom) is not a standard method. Option D (random) alone isn't valid without Math. prefix.