You are not logged in.
- Index
- » Quiz Questions
- » Class Value:
- 0
Pages:: 1
#1 2015-06-12 06:34:43
Class Value:
Java Quizzes Java Language Overriding And Overloading
Directions:
class A{
int i = 10;
public void printValue(){
System.out.print("Value-A");
}
}
class B extends A{
int i = 12;
public void printValue(){
System.out.print("Value-B");
}
}
public class Test{
public static void main(String args[]){
A a = new B();
a.printValue();
System.out.print(a.i);
}
}
Question:
What will be the output?
Option A):
Value-B 10
Option B):
Value-B 13
Option C):
Value-B 11
Option D):
Value-B 12
Correct Answer is Option A):
Value-B 10
You cannot discover the new oceans unless you have the courage to lose the sight of the shore.
Offline
2015-06-12 06:34:43
- Advertisement
- Ads By Google
Re: Class Value:
\n
Pages:: 1