Problems with adding an additional Java class

已回答

I am new to Java & IntelliJ and have gone through JB IntelliJ tutorial in YT. 

I managed to create & run the Hello World program. I created another class (TempConversion) under the same package for another exercise (see screen shots below). Unfortunately, the second class does not work. I could not understand the error message.  Pls help 

 

0

In the second class, you are calling the commands inside class itself, however a function is required. 

The correct example would be 

public class TempConversion {
public static void main(String[] args) {
int saturdayFarenheit;
saturdayFarenheit = 78;
double saturdayCelsius = (5.0/9) * (saturdayFarenheit -32);
System.out.println("WeekAverage");
System.out.println("Saturday: " + saturdayCelsius);
}
}
1

请先登录再写评论。