Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package Project1;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.     Car car = new Car();
  8.     //Car car = new Car("opel", "astra", 10000);
  9.    
  10.     System.out.println(car.getBrand());
  11.    
  12.     }
  13.  
  14. }
  15. package Project1;
  16.  
  17. public class Car {
  18.     private String brand;
  19.     private String model;
  20.     private double price;
  21.    
  22. /*  public Car(String brand, String model, double price) {
  23.         this.brand = brand;
  24.         this.model = model;
  25.         this.price = price;
  26.        
  27.     }*/
  28.    
  29.     public Car() {
  30.         this.brand  = null;//tuk moje i bez this, za6toto nqma parametur v Car()
  31.         this.model = null;
  32.         this.price = 0.0;
  33.     }
  34.    
  35.     public String getBrand() {
  36.         return brand;
  37.     }
  38.    
  39.     public void setBrand(String brand) {
  40.         this.brand = brand;
  41.     }
  42.     public void maxSpeed() {
  43.        
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement