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 / suma.k
in main method
Base b1=new Base ();
b1.m1();
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
please mail me the interview question based on java/j2ee
What are the interfaces in java collections? : java collections
What are the considerations to be made in case of loops in java ?
What are the different types of features of the java collections framework? : java collections
What is an algorithm in java collection framework? : java collections
what is mean by hasing and maping in java platform and advantage?
What is the use of the list interface in the java collection? : java collections
Which java collection class can be used to maintain the entries in the order in which they were last accessed?
How is hashset maintained in memory by java ?
What is iterator in the java collections framework? : java collections
Should we create system software ( e.g operating system ) in java ?
What are maps interfaces in the java collections? : java collections
What is the Spring2.5 MVC Navigation flow?
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.?.
What are the types of the main implementing classes in the map interfaces? : java collections