File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hi to all

 
zama syed
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is difference in s and s1 in the below program:


'm getting error for s1.........
 
Stephan van Hulst
Bartender
Pie
Posts: 4828
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference is that s1 is a member of the class, whereas s is a local variable in the main method. The reason you're getting an error is that you can't have loose statements in the class body.
The line s1 = new String[10] should be either in a method or constructor body, or you should initialize s1 directly.
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, and welcome to JavaRanch!
Please take a moment to read our FAQ on HowToAskQuestionsOnJavaRanch, specifically the secion on using meaningful subject lines.
 
Bobby Smallman
Ranch Hand
Posts: 107
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What a tricky thread name! I got all excited that someone just wanted to say hi and THEN I feel very deceived when I find out there is a question in here! There must be some evil mastermind behind this dastardly thread!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic