Writing a function inside the main method – Java

No, you can’t declare a method inside another method.

If you look closely at the code you provided it is just a case of bad formatting, the main method ends before the max method is declared.

Leave a Comment