Abstract is a class.
Abstract has devided into two parts.
1.abstract class
2.abstract method
abstract class cars{
public abstract void quality();
public void speed() {
System.out.println("the speed of car is"+120 +"km/hr");
}
public void colour() {
System.out.println("red");
}
}
class car extends cars{
public void quality() {
System.out.println("american");
}
}
public class abstractmethod {
public static void main(String[] args) {
car myFarari=new car();
System.out.println("colour of car is");
myFarari.colour();
myFarari.quality();
//System.out.p
myFarari.speed();
}
}
No comments:
Post a Comment