Results 1 to 5 of 5
Thread: Where do I put main method?
- 09-16-2009, 06:00 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 1
- Rep Power
- 0
- 09-16-2009, 06:19 PM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Technically you can put it anywhere. Conventionally,it depends on what is going to be done in that main method. e.g If it's going to test your Car class then you can put it either in the Car class or in a separate class called CarTest. The preferred method is a separate class called CarTest.
- 09-16-2009, 07:10 PM #3
The main can be put anywhere inside of a class that any other method can be. I typically put it at the very bottom of the class just before the closing "}"
My Hobby Project: LegacyClone
- 09-16-2009, 07:44 PM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Count your braces { and } must match.
If you indent your code properly it will be obvious where the problem is.
- 09-16-2009, 08:23 PM #5
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
Main method here to :S:S hlp pls
By eliCanzee in forum AWT / SwingReplies: 6Last Post: 05-27-2009, 04:45 AM -
Help me for main method
By eliCanzee in forum AWT / SwingReplies: 1Last Post: 05-26-2009, 12:43 PM -
Private main method
By bugger in forum New To JavaReplies: 1Last Post: 12-21-2007, 09:45 AM -
main method
By eva in forum New To JavaReplies: 5Last Post: 12-19-2007, 09:25 AM -
The main method in java...
By lenny in forum New To JavaReplies: 1Last Post: 07-31-2007, 06:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks