In this post, you can test your knowledge of Java fundamental concepts.
What is Java?
Answer:
Explanation:
Java is a widely-used object-oriented programming language.
2. Which company developed Java?
Answer:
Explanation:
Java was originally developed by Sun Microsystems, which was later acquired by Oracle Corporation.
3. What does JVM stand for?
Answer:
Explanation:
JVM stands for Java Virtual Machine, which provides the runtime environment for executing Java bytecode.
4. Which keyword is used to create an object in Java?
Answer:
Explanation:
The new keyword is used to create a new instance of a class in Java.
5. What is the default value of a boolean data type in Java?
Answer:
Explanation:
The default value of the boolean data type in Java is false.
6. What is the superclass of all Java classes?
Answer:
Explanation:
In Java, the Object class is the ultimate parent class of all classes.
7. Which of these keywords is used to inherit a class?
Answer:
Explanation:
The extends keyword is used to inherit properties and behavior from a superclass.
8. Which method is called when an object is instantiated from a class?
Answer:
Explanation:
A constructor method is called when an object is instantiated from a class. It has the same name as the class.
9. Which of the following is used to handle exceptions?
Answer:
Explanation:
try-catch blocks are used to handle exceptions in Java. throw and throws are related to exceptions but are used for different purposes.
10. What is the size of a long data type in Java?
Answer:
Explanation:
In Java, the long data type is 64 bits in size.