Hi guys,
So I'm messing around with Java trying to get a feel for how things work,
It's really confusing when a line of code doesn't tell me what it is.
package myPackage;
public class Calculators {
static Integer val1 = 5;
static Integer val2 = 5;
public static void main(String[] args) { //method
Integer val3 = val1 * val2;
System.out.println(val3);
}
}
So what is this main here ? is it a class or a method ?
If it's a class, why cant I execute the println code in the Calculators class ?
if it's a method, why is it being called a main class all over the web. :/ Or rather, if main is a method, then does every class need a main method ? or what needs it ?