main method should be:
public static void main(String[] args)
and not:
public static boolean main(String[] args)
You probably wanted to do something like this:
public static boolean check()
{
if (0.1 + 0.1 + 0.1 == 0.3) return true;
else return false;
}
and then call it from the static main:
public static void main(String[] args)
{
boolean result = check();
//now you can print, pass it to another method.. etc..
}
Why main is void (doesn't return anything)?
- Think about it. Once the main method finishes, it doesn't mean that the program finished. If it spawns a new thread it might be that these threads are still running.
Why main is public?
- The main method is called by the JVM to run the method which is outside the scope of project.
Why main is static?
- When the JVM calls the main method, there is no object existing for the class being called. So it has to have static method to allow this from class.
booleanfrom main?