Good evening all, I am a new member to this forum, it seems like a great place for beginners like me!
I am at the very beginning of my Java education and I am having a little trouble with an exercise involving Static Methods.
This exercise is designed to introduce me to invoking static methods inside a class without instantiating an object. Basically; I am just trying to print out the value of a returned calculation, but I am getting a compile error. I'll paste me code below. Thanks in advance for any guidance
public class MyMath {
public static long square(int a){
long b = (long) (a*a);
return b;
}
}
public class Squares {
public static void main(String[] args) {
MyMath.square(12);
System.out.println(MyMath.square());
}
}