Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Lol {
- public static Scanner reader = new Scanner(System.in);
- public static void main(String args[]) {
- Car idk = new Car(4,"lambo","white");
- String test = idk.print();
- System.out.println(test);
- }
- }
- =============================================================================
- public class Car {
- private int wheels;
- private String model;
- private String color;
- public Car (int wheels , String model , String color)
- {
- this.wheels = wheels;
- this.model = model;
- this.color = color;
- }
- public int getWheels() {
- return wheels;
- }
- public String getColor() {
- return color;
- }
- public String getModel() {
- return model;
- }
- public void setColor(String color) {
- this.color = color;
- }
- public void setModel(String model) {
- this.model = model;
- }
- public void setWheels(int wheels) {
- this.wheels = wheels;
- }
- public String print(){
- String test= " wheels: "+wheels+" model: "+model+" color: "+color;
- return test;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement