Hi,
In structured programming language like c we could create a method in main().In java its not possible.Why? Or is there any way we can create a method in main using keywords like static or something of that sort.
Output:
In main()
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: met
at A.main().java:5
BUILD SUCCESSFUL (total time: 3 seconds)
Yes i know if we place the met() method outside main() and within class A scope then it will run.But cant we do it like a simple c program with methods inside main.I don't need to know what can be the use of it.But can we do it in any other way or not?Let
me know if there is any possible way.
Thanks in advance