| Author |
method inside main method
|
Asanga Aux
Greenhorn
Joined: Oct 19, 2009
Posts: 1
|
|
Hey,
Why cant we declare a method inside the main method and call it?
why its giving illegal start of expression ?
Thank You.
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
inside a main method ,you can declare a method(static) . but you cant define(implement) a method.
Hope this helps
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
and welcome to javaranch
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12928
|
|
Welcome to JavaRanch.
Because it is simply not possible in Java to define methods inside methods. It's just not part of the language's syntax.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: method inside main method
|
|
|