i will explain something about abstract class and methods.
What is abstract class?
-> Abstract class is a class that is declared abstract keyword, it may or may not include abstract methods.
-> we cannot create object for abstract class, but we can call abstract class method using derived class objects.
-> When an abstract class is inherited, the child usually provides implementations for all of the abstract methods in its parent class.
simple example to understand:
Consider college id card, suppose the college give chance to prepare id card to student itself na, all students are designed id card with different details..so only college administration designed id card with same details…
in this way consider id card as a base class and students are derived class…we must need to use the methods in base class…
hence, when the situation arise the derived class must need to use (implement) base class method na,that time better to use abstract…
abstract class common_id
abstract void idno();
abstract void sname();
abstract void dept();
class student extends common_id
Scanner sc=new Scanner(System.in);
System.out.println("enter your idno");
System.out.println("enter your name");
System.out.println("enter your dep");
public class studex
public static void main(String args)
student s=new student();
enter your idno :1001
enter your name : deepika
enter your dep : CSE