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
Class c implements interface I containing method m1 and m2 declarations. Class c has provided implementation for method m2. Can I create an object of class c?
What is a map? What are the implementations of map?
How to print an arraylist in java?
How to check if linked list contains loop in java?
What is string [] java?
Difference between static and dynamic class loading.
Explain method overloading?
Can you make a constructor final in Java?
Why for each loop is used?
What are the differences between abstract class and interface?
What 4 doubled?
How many types of interfaces are there?
What are the data types supported by java? What is autoboxing and unboxing?
What is merge sort in java?
What is the difference between the paint() and repaint() methods?