Java Online Quiz


Advertisements


Following quiz provides Multiple Choice Questions (MCQs) related to Core Java. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Answer : A

Explaination

A class is a blue print from which individual objects are created. A class can contain fields and methods to describe the behavior of an object.

Q 2 - Can we have multiple classes in same java file?

A - True

B - False

Answer : A

Explaination

True, a java file can contain one public class and many other non-public classes.

Q 3 - What is the default value of double variable?

A - 0.0d

B - 0.0f

C - 0

D - not defined

Answer : A

Explaination

double variable has default value of 0.0d if defined as an instance/static variable.

Answer : C

Explaination

By default, variables, methods and constructors can be accessed by any class lying in the same package.

Answer : B

Explaination

An immutable object can't be changed once it is created. String objects are immutable.

Answer : C

Explaination

Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application.

Answer : A

Explaination

If a class has multiple functions by same name but different parameters, it is known as Method Overloading.

Answer : A

Explaination

These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.

Answer : A

Explaination

Runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time. In this process, an overridden method is called through the reference variable of a superclass.


java_questions_answers.htm

Advertisements