ExamVeda
Login
Home
1
What is a constructor in Java?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
2
Which keyword is used to define a method in Java?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
3
In Java, which method is automatically called when an object is created?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
4
What is method overloading in Java?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
5
What does the "void" keyword indicate in a method declaration?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
6
Which access modifier is used for a method that can be accessed from any class in the same package?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
7
What is the return type of a constructor in Java?
Discuss
Answer & Solution
Answer: Option C
Solution:
Constructors are special methods in Java used to create objects of a class.
They have the same name as the class itself.
Unlike other methods, constructors don't have an explicit return type.
Their job is to initialize the object's member variables (fields) with values.
Therefore, they implicitly return a reference to the newly created object.
The correct answer is option C, because it correctly states the return type is implicitly the same as the class name.
8
What is the purpose of the "this" keyword in Java constructors and methods?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
9
Which keyword is used to prevent method overriding in Java?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
10
What is the correct syntax to call a method named "myMethod" from an object "myObject"?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board