Vikhyath_11

1

Jul 28th, 2024
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package vehical;
  2.  
  3. public class Vehical {
  4. int num_of_seats;
  5. int num_of_wheels;
  6.  
  7. public Vehical(int seats,int wheels){
  8. this.num_of_seats=seats;
  9. this.num_of_wheels=wheels;
  10. }
  11.  
  12. public void display(){
  13. System.out.println("seats= "+num_of_seats);
  14. System.out.println("whees= "+num_of_wheels);
  15. }
  16. public static void main(String[] args) {
  17. Vehical car = new Vehical(4,4);
  18. Vehical bike = new Vehical(1,2);
  19. System.out.println("The details of car :");
  20. car.display();
  21. System.out.println("The details of bike :");
  22. bike.display();
  23.  
  24. }
  25.  
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment