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 are basic data types?
Should you use singleton pattern?
What is int lol?
What is Java Reflection API? Why it’s so important to have?
What is the difference between char and char *?
Explain all java features with real time examples
Is a class subclass of itself?
What is bufferedwriter?
Which method cannot be overridden in java?
What is adapter in java?
What is regex java?
how does the run() method in runnable work? : Java thread
What does singleton mean in java?
What is the use of java?
In the below example, what will be the output?