Java Quiz Lesson 4
Java Quiz Lesson 4
A) new
B) Thread
C) Runnable
D) extend
Answer: B) Thread
A) 0
B) null
C) false
Answer: B) null
A) System.gc()
B) gc.collect()
C) Runtime.collect()
D) System.cleanup()
Answer: A) System.gc()
A) List
B) Set
C) Collection
D) Queue
Answer: C) Collection
A) Use a try-catch block or declare the exception using the throws keyword.
Answer: A) Use a try-catch block or declare the exception using the throws
keyword.
6. Which of the following methods can be used to check the length of a string
in Java?
A) length()
B) size()
C) count()
D) getSize()
Answer: A) length()
8. Which of the following collections does not allow null elements in Java?
A) HashSet
B) TreeSet
C) ArrayList
D) LinkedList
Answer: B) TreeSet
A) Throwable
B) Error
C) Exception
D) RuntimeException
Answer: A) Throwable