File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "transform from init() to main()?" Watch "transform from init() to main()?" New topic

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.
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

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.
- Manish
p.s. Of course, applet will have much more restriction regarding access to local files and remote server connections.
I agree. Here's the link:
subject: transform from init() to main()?
It's not a secret anymore!