Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

applet and application?  RSS feed

 
rama murthy
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you write a Java class that could be used both as an applet as well as an application?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you think it's possible? What makes an application an application? What makes an applet an applet? Answering these two questions will lead you to the answer.
 
rama murthy
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets doesn't have a main method. If we add a main method to applet, doesn't an applet behave both as an applet as well as an application.

Applets can be executed in web browser whereas java application can't be executed in a browser.
[ May 29, 2006: Message edited by: rama murthy ]
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct - a class can both extend java.applet.Applet and have a main method - thus it can be used in both contexts.

For additional fun, it could implement javax.servlet.Servlet, and thus be used as a servlet as well.
 
rama murthy
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf Dittmer.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!