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. getColumnClassName(int column)

  2. getScale(int column)

  3. isCaseSensitive(int column)

  4. getColumnSize(int column)

  5. isSearchable(int column)

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

This is the correct answer because there is no method named getColumnSize(int column) in ResultSetMetaData interface. The correct method name is getColumnDisplaySize(int column), which indicates the designated column's normal maximum width in characters.

Multiple choice
  1. allProceduresAreCallable()

  2. allTablesAreSelectable()

  3. autoCommitFailureClosesAllResultSets()

  4. dataDefinitionCausesTransactionCommit()

  5. allTablesSelected()

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

This is the correct option because there is no method named allTablesSelected() in DatabaseMetaData. The correct method is allTablesAreSelectable() and it retrieves whether the current user can call all the procedures returned by the method getProcedures or not.

Multiple choice
  1. getTime()

  2. Time()

  3. getMilliseconds()

  4. getTimeInMilliseconds()

  5. Milliseconds()

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

This is the correct option because getTime() method is defined in the Timestamp class in Java and it returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Timestamp object.

Multiple choice
  1. 10

  2. 9

  3. 8

  4. 7

  5. 6

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

This is the correct answer because there are 9 methods defined in the Date class. These are: 1) getHours() 2) getMinutes() 3) getSeconds() 4) setHours(int i) 5) setMinutes(int i) 6) setSeconds(int i) 7) setTime(long date) 8) toString():  9) valueOf(String s)