I am new to Java and was wondering how to display details through
public static void main(String [] args){
For example I have a classes, and I need make a separate class called ClassSeperate which sole purpose is to create an object with valid values from the NewCar class and print them using
public static void main(String [] args){
Say i make this class and have the right constructors accessors and such etc etc
Public class NewCar,
private String carMake;
private String carColor
private int carYear
private int kmsDriven;
I want to implement my own values and set the number of kmsDriven to 50.
So I go to the SeperateClass and type in
public static void main(String [] args){`
NewCar car = new NewCar("FERRARI","YELLOW",2020,50)
System.out.println(?)
I am not quite sure how to print those details i just put into the object in void main. I tried System.out.println(car.toString());
but when i click on the void main nothing pops up? Any help is appreciated!