aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes transform from init() to main()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "transform from init() to main()?" Watch "transform from init() to main()?" New topic
Author

transform from init() to main()?

jordan gong
Ranch Hand

Joined: Jun 12, 2001
Posts: 37
Dear Sir/Madam:
Is an applet initialized by init() also called an Java application? Is it also a stand-alone application that runs everywhere?
Does anybody know some easy way to transform the applet written by init() into main()? I understand that in main(), you should use frame container.
Thanks.
jordan
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

If you haven't yet started coding, you are lucky.
You can very much have public static void main(String args[]) in an applet, no compiler error!!! Keep both init() and main() there, place common code in diff. methods, place code specific applet and application in diff. set of methods and have main() and init() call these methods accordingly. It's difficult to do it if you already have your applet ready, but at design stage you can plan it proprly, it's fun doing both.
HTH,
- Manish
p.s. Of course, applet will have much more restriction regarding access to local files and remote server connections.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: transform from init() to main()?