line 9 "Identifier expected.
Norm Radder wrote:
line 9 "Identifier expected.
That type of statement must be inside of a method or static block.
When do you want that statement to be executed?
statement should be executed immediately when running the project.
show an example of this inside a method?
Norm Radder wrote:
statement should be executed immediately when running the project.
The first statements executed when a program is started is the main method for the starting class (the class named with the java command).
show an example of this inside a method?
See lines 10 and 11 in JavaApplication1 for an example of calling a method from inside of another method
yields no output
using the main method as an invoker to other classes' methods?
So it is good design to use the main method to start the app, and for nothing else. Once you have got the app started, the app should control itself. That makes me worry whenever I see people going on about main “classes”. That makes me think somebody has told them there is a concept that one class controls the app.Norm Radder wrote:. . . there must be a chain of execution that starts in the original main method.
the main method is just an "entry point" for the program execution
execute separately class by class files.
main method as a launcher with chain of execution assigned in it
Doug Mann wrote:... the whole main affair as just a line we must put somewhere (with blank body), while execution is performed under the hood on all the other classes in the directory
Python for example get code execution with no main, it just executes a like a list top to bottom?
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|