Which of the following statements are incorrect? a) Default constructor is calle
ID: 2844823 • Letter: W
Question
Which of the following statements are incorrect?
a) Default constructor is called at the time of declaration of the object if a constructor has not been defined.
b) Constructor can be parameterized.
c) finalize() method is called when a object goes out of scope and is no longer needed.
d) finalize() method must be declared protected.6. What is the output of this program?
class overload {
int x;
int y;
int add(int a) {
x = a + 1;
}
int add(int a , int b){
x = a + 2;
}
}
class Overload_methods {
public static void main(String args[])
{
overload obj = new overload();
int a = 0;
obj.add(6);
System.out.println(obj.x);
}
}
a) 5
b) 6
c) 7
d) 8
Explanation / Answer
c)7
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.