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
What are the considerations to be made in case of loops in java ?
What is an algorithm in java collection framework? : java collections
How do I find jre path in windows?
What is the Spring2.5 MVC Navigation flow?
What is java collection? : java collections
What do you understand by synchronization? Why is it important?
What is the use of the list interface in the java collection? : java collections
What are the differences between the java collection and the java list? : java collections
What are the interfaces in java collections? : java collections
What is the enumerator of the java collection framework? : java collections
What are the main classes of the list interfaces? : java collections
what is mean by hasing and maping in java platform and advantage?
Hi frnds how to lock an user when he enter wrong credentials more than 3 time using java or j2ee tech take username and password in a bean no need to connect DB and validate give me some sample application code or links its urgent for me thanks in advance
What are the different types of classes implemented in the set interfaces? : java collections
What is deque in the java collections framework? : java collections