How to call the m1() method of Base class in below snippet ?
class Base
{
public void m1()
{
System.out.println("Base m1 ");
}
public void m2()
{
System.out.println("Base m1 ");
}
}
======================
class Derived extends Base
{
public void m1()
{
System.out.println("Derived m1");
}
public void m3()
{
System.out.println("Derived m3");
}
public static void main(String[] args)
{
Base ob=new Derived();
ob.m1();
//System.out.println("Hello
World!"+ob.m1());
}
}
Answer Posted / mitu
class Derived extends Base
{
public void m1()
{
System.out.println("Derived m1");
}
public void m3()
{
System.out.println("Derived m3");
}
public void m26()
{
super.m1();
}
public static void main(String[] args)
{
Derived ob=new Derived();
ob.m1();
ob.m26();
}
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
what is mean by hasing and maping in java platform and advantage?
who will give req's to u?. how they send req's to u? . what design documents contains?. when bugs raised on other developer code how to report to them?.(throgh mail or ........). how to retrive 100 recods from dao layer to presentation layer.using which collection?. what is sequence diagram.?.
How do I find jre path in windows?
Which interface does java.util.hashtable implement?
Hi Friends , am newbie to ajax. For example just consider one account registration - A form contains 8 text fields with submit button. In this form second texbox contains "username " . On right side of text box there is a label box . On clilck action i need to determine user is available or not. Is it possible on clicking label or should i click submit button.
What is deque in the java collections framework? : java collections
Hi we have an urgent requirement for Java/J2ee technical lead position & also looking for "Java Guidewire claimcentre" experienced professional for Bangalore location if interested can reach srisanh@gmail.com
Which server-side script takes the input from JavaScript, can access the database if it needs to, and processes the data.
can u draw class/object diagram for ATM
What are the uses of the set interfaces in the java collections? : java collections
Which sorting algorithm is used by collections.sort() in java ?
What do you understand by synchronization? Why is it important?
What are the differences between the java collection and the java list? : java collections
What are the main classes of the list interfaces? : java collections
Explain the OOPS concept in Realtime Scenarion ? Take example as CAR. Please explain indetail ?