Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to call child class method from parent class in java

//Hope it helps
//This is the child class
public class child
{
    public classCall()
    {
    	String str = "I am the child class accessed from parent class!!!";
    }
}
//this the parent class
class parent
{
	public static void main(String args[])
    {
    	child obj = new child(); //objext of child class is created
    	System.out.println(obj.classCall()); //'classCall method is called from child class
    }
}
 
PREVIOUS NEXT
Tagged: #call #child #class #method #parent #class #java
ADD COMMENT
Topic
Name
9+5 =