actually you can have your set method change to a constructor
Code:public class Car { private int year; private int size; private int gear; public Car(int y, int s, int g) { year = y; size = s; gear = g; } public void tell() { System.out.print("You car is " + size +" big and "); System.out.print("was made in "+ year +" and has "); System.out.println(gear +" gears."); } public static void main(String[] args) { Car volvo = new Car(1998,100,5); volvo.tell(); } }





Reply With Quote