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. StringReader

  2. PipeReader

  3. InputReader

  4. Both (1) and (2)

  5. Both (1) and (3)

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

There is no subclass of Reader class named InputReader. The correct name is InputStreamReader used for reading a character stream. So, this is the correct answer according to the question.

Multiple choice
    • 1
  1. 11

  2. 6

  3. Compiler error : method lastIndexOf() not declared

  4. Compiler error : parameters to method not sufficient

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

lastIndexOf(String s, index i) method return the last occurrence of string "s" before the index value i. it Return -1 if string not found. So here the string to find is “Java” before the index value 5 which means before the character "m". but string “java” is not present before the index 5 i.e character "m" .so it will return -1. So this is the correct answer.