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.
More Related Contents:
- Purpose of a constructor in Java?
- How can I create a Java method that accepts a variable number of arguments?
- How do Java programs run without defining the main method?
- Can there exist two main methods in a Java program?
- Java Questions! About List and Objects
- The syntax of the method [closed]
- nothing happens when i execute the code. Got my methods right? [closed]
- Is it possible to change the return value of a method in this case? [closed]
- Java Array Parameter and Array Type Metot [closed]
- Which overload will get selected for null in Java?
- Java synchronized static methods: lock on object or class
- Why does this Java method appear to have two return types?
- Why doesn’t Mockito mock static methods?
- Converting Integers to Roman Numerals – Java
- Should private helper methods be static if they can be static
- Set and Get Methods in java?
- Count words in a string method?
- How do I intercept a method invocation with standard java features (no AspectJ etc)?
- Are there any Java method ordering conventions? [closed]
- If statement using == gives unexpected result [duplicate]
- Can non-static methods modify static variables
- What does ‘public static void’ mean in Java?
- Could not find or load main class with a Jar File
- Varargs Java Ambiguous Call
- Java Inheritance – calling superclass method
- Final arguments in interface methods – what’s the point?
- What is the equivalent of Regex-replace-with-function-evaluation in Java 7?
- Naming conventions for Java methods that return boolean
- Lambda implementation of interface in kotlin
- Why do applets not need a main()?