1Abstract Class :
abstract class Base {
abstract void printInfo();
}
class Derived extends Base {
void printInfo()
{
String name="avinash";
float salary = 333.3f;
int age=21;
System.out.println(name);
System.out.println(salary);
System.out.println(age);
}
}
class abstraction {
public static void main(String args[])
{
Base b = new Derived();
b.printInfo();
}
}
No comments:
Post a Comment