Since I started studying Java Silver, I will upload it as my memorandum. Since it is a rough memo, details are not described.
About the return type in the method definition.
Method to return int type int method(int num){ return num * 5; }
If no return value is returned void method(int num){ System.out.println(num); }
If you declare a return type without returning a return value, a compile error will occur. Also, if you try to return with a type different from the declared return type, a compile error will occur.
Recommended Posts