80 Java Trivia Questions with Answers
80 public questions with answers, drawn from the well. How many can you answer?
What is the default access modifier for a class member in Java?
Answer
package-private
What annotation is used to mark a functional interface in Java?
Answer
@FunctionalInterface
What is the keyword used to define an interface in Java?
Answer
interface
What is the name of the runtime optimization that compiles Java bytecode to native machine code?
Answer
Just-in-time (JIT) compilation
What is the method name used to start a thread in Java?
Answer
start()
What is the concept of removing generic type information at runtime called?
Answer
Type erasure
What is the default garbage collector in Java 9 and later?
Answer
G1 (Garbage-First)
What is the package for input and output operations in Java?
Answer
java.io
Which version of Java introduced lambda expressions?
Answer
Java 8
Which keyword in Java is used to declare a constant?
Answer
final
What does JVM stand for?
Answer
Java Virtual Machine
Which company originally developed Java?
Answer
Sun Microsystems
What is the famous slogan associated with Java?
Answer
Write once, run anywhere
In what year was Java first publicly released?
Answer
1995
Who created the Java programming language?
Answer
James Gosling