abstract class Demo {
public void show()
{
System.out.println("Hello I am In show method of Abstract
class");
}
}
class Sample extends Demo
{
public void show()
{ super.show();
System.out.println("Hello I am In Sample ");
}
}
public class Test
{
public static void main(String[] args) {
//I WANT TO CALL THE METHOD OF BASE CLASS IT IS POSSIBLE OR NOT
CAN WE USE SCOPE RESOLUTION OPERATOR TO CALL OR JAVA NOT
SUPPORTED THAT :: OPERATORE
}
}
Answer Posted / kuldeep
public class Test extends Demo {
public static void main(String[] args) {
Demo obj=new newQuestion();
obj.show();
}
//use this code in the main it will call the base method
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is an interface in java? Explain
What is a parent class in java?
What is a predicate method?
Explain restrictions on using enum?
What is difference between equals and hashcode method?
What is a memory leak in java?
How do you use compareto?
Can you extend singleton class?
What is difference between protected and private?
Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.
How can we create objects if we make the constructor private ?
What do you mean by a JVM?
Does java list allow null?
Can I learn java in 3 months?
What is an association?