• Post Reply Bookmark Topic Watch Topic
  • New Topic

Urgent Pls  RSS feed

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
1)
I would like to know y static method are been used for the class to b loaded
Like u have
public static void main(String args[]) -- for the class to b loaded
Y only static??
2)
And regarding Swings.
I would like to know y swings r light weight components??

Do clear my dbts,I would b thankful
Thanks in advance
regards
Smitha
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
main needs to be static as the virtual machine can only operate on a class not an instance of a class. If main weren't static you'd need an instance of an object to start an application... but you can't create an instance until the program starts. So basically you're telling the VM to find a class, find a method on that class then execute it.
Swing components are not dependant on the underlying operating system, they basically tell the VM how to draw the gui rather than letting the OS do it (as is the case with 'heavy weight' components from AWT).
Hope this helps
Charlie
 
author & internet detective
Marshal
Posts: 37518
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Smitha,
Swing components are light weight because they are written in Java. The lightness comes from the fact that they do not rely on the operating system.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!