Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception handling

 
Smitha Prasad
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when both the init() method and main() method are there which is executed first?
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's an applet it is init(), if it is an application it is main() which the starting point.
Note that in both the cases, you can have you can have these two methods w/o any problem.
HTH,
- Manish
BTW, the subject of this post could be misleading esp since you already have a post by same subject.
 
Smitha Prasad
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi manish, thanks for the info
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Smitha, if you were to simply try out a couple of examples you'd see what happens.
Consider:

If this code is used as an applet, to the console it would display:
  • constructor
  • init
  • start
  • paint

  • If this same code were run as an application (java TestProgram), then it would display:
  • main
  • constructor


  • Good Luck.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic