When their is method name and method body then it is called Concreate Method or Complete Method.
public class Animal
{
public void cal()// method name
{
int max = 0;//method body
}
}
When their is method with only method name then it is called abstract method. In simple words abstract means incomplete.
abstract public class Animal //if there is single abstact method present then we have to make the whole class abstract
{
abstract public void cal();//only method name is attached with abstact keyword
}
public class Dog extends Animal{
public void cal(){
// body
cal(){
System.out.println("hello, Ji");
}
public static void main(String[] args){
Dog d = new Dog();
d.cal()
}
}
Object of abstract class can be created by calling the child constructor while initializing.
abstract public class Animal //if there is single abstact method present then we have to make the whole class abstract
{
abstract public void cal();//only method name is attached with abstact keyword
}
public class Dog extends Animal{
public void cal(){
// body
cal(){
System.out.println("hello, Ji");
}
public static void main(String[] args){
Animal a = new Dog();
a.cal()
}
}