Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. package kwiecien.dziewiaty;
  2.  
  3. public class Car {
  4.     String name;
  5.     String color;
  6.     String engine;
  7.  
  8.  
  9.     public Car() {
  10.     }
  11.  
  12.     public Car(String name, String color, String engine) {
  13.         this.name = name;
  14.         this.color = color;
  15.         this.engine = engine;
  16.     }
  17.  
  18.     public void printCar(){
  19.         System.out.println("Nazwa: " + name + ", kolor: " + color + ", silnik: " + engine);
  20.     }
  21.  
  22.     public void switchCarName(String carName){
  23.         this.name = carName;
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement