Q- Given:-
class A {
static int hitCount;
static void printHitcount ( ) {
System.out.println("A class " + hitCount);
}
}
class B extends A {
static void printHitCount ( ) {
System.out.println("B class " + hitCount);
}
}
and
A.hitCount = 100;
B.hitCount = 200;
A.printHitcount ( );
B.printHitcount ( );
What is the result?
A) A class 200
B class 200
B) B class 200
B class 200
C) A class 100
A class 200
D) A class 100
B class 200
⧪ please give your answer in a comment section.
class A {
static int hitCount;
static void printHitcount ( ) {
System.out.println("A class " + hitCount);
}
}
class B extends A {
static void printHitCount ( ) {
System.out.println("B class " + hitCount);
}
}
and
A.hitCount = 100;
B.hitCount = 200;
A.printHitcount ( );
B.printHitcount ( );
What is the result?
A) A class 200
B class 200
B) B class 200
B class 200
C) A class 100
A class 200
D) A class 100
B class 200
⧪ please give your answer in a comment section.
2 Comments
C
ReplyDeleted
ReplyDelete