File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

basic question

 
Saumyaraj Zala
Ranch Hand
Posts: 56
Android Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the things that comes inside a class and outside a method.....for example the declaration of instance variable....Can i write statements outside a method??? Till now I wrote my programs with instance variables outside the method but what more can we write outside a method?? Is method necessary for writing statements??? Can i write my java program without method??? Please help...
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33718
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can write static or instance variable instantiation blocks outside a method. You can't write your whole program without a method though as programs kick off with a main() method.
 
Saumyaraj Zala
Ranch Hand
Posts: 56
Android Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i am not telling that i will not use the main method...i know about its importance
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33718
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i write my java program without method???

You asked if you could write a program without any methods.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic