Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package vehical;
- public class Vehical {
- int num_of_seats;
- int num_of_wheels;
- public Vehical(int seats,int wheels){
- this.num_of_seats=seats;
- this.num_of_wheels=wheels;
- }
- public void display(){
- System.out.println("seats= "+num_of_seats);
- System.out.println("whees= "+num_of_wheels);
- }
- public static void main(String[] args) {
- Vehical car = new Vehical(4,4);
- Vehical bike = new Vehical(1,2);
- System.out.println("The details of car :");
- car.display();
- System.out.println("The details of bike :");
- bike.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment