Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

transform from init() to main()?

 
jordan gong
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2595
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic