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
How to reverse a string in java?
Differece between class and generic class?
When should we create our own custom exception classes?
Is main a keyword in java?
Difference between comparator and comparable in java?
How do you break a loop?
What is a singleton factory?
What are the new features in java 8? Explain
Can an interface have a class?
what is encapsulation in java? Explain
Why can't we make a class private in java?
What is java life cycle?
Explain different forms of polymorphism?
What should I import for arraylist in java?
Is java 9 released?