Java example of Abstract class and abstract methods and declared abstract
#declared_abstract #abstract_keyword #abstract_methods #Abstract #class #java ,
Abstraction is a process of hiding the implementation details and showing only functionality to the user.
below is key point to remaimber when you creating abstract class.
For More details visit official Documentation
package com.developer;
abstract class Car
{
int reg_no;
Car(int reg)
{reg_no=reg;
}
abstract void price(int p);
abstract void braking(int force);
}
package com.developer;
class Maruti extends Car
{
Maruti(int reg_no)
{
super(reg_no);
}
void price(int p)
{
System.out.println("this show the price of maruti car");
}
void braking(int force)
{
System.out.println("the maruti cars use hydraulic brakes");
}
public static void main(String args[])
{
Maruti m = new Maruti(10);
m.price(7);
m.braking(9);
}
}
Here we learn how to implement Abstract class in Java .
with example of Car and Maruti as sub class.
Hope you like it subscribe our instagram and facebook account for more update .