• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please fix this code..............urgent......some minor errors in compiling  RSS feed

 
Abhinav Arya
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Next time you post please keep in mind these suggestions:
1) UseRealWords: Plzzz is not a real word and can cause confusion.
2) UseCodeTags: It makes reading the code much easier
3) TellTheDetails: For example stack traces and real error messages - it makes it much easier to diagnose problems.

The problem is that you are defining static variables inside a method. You can't do that. The static variables must be class member variables (ones that aren't in methods).

edit: I added the code tags this time. Next time, please do it yourself...
 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve forgot EaseUp.

Abhinav Arya, you're used to C or C++ programming, aren't you? In case you are, Java doesn't know static local variables, only static fields. As such, they must be moved outside the method.
 
Abhinav Arya
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Steve Luke ,
Thanks for the reply but even after declaring the variables in class outside the method I get these errors:

SriramSMS.java:12: cannot find symbol
symbol : class OutputStream
location: class SriramSMS
static OutputStream outputStream;
^
SriramSMS.java:33: cannot find symbol
symbol : class CommDriver
location: class SriramSMS
CommDriver commdriver = (CommDriver)Class.forName(driverName).newInstance();

^
SriramSMS.java:33: cannot find symbol
symbol : class CommDriver
location: class SriramSMS
CommDriver commdriver = (CommDriver)Class.forName(driverName).newInstance();




Please help me out!!!



Actually this is a code which I want to use for sending sms in my web app.........
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to import these classes.

It might be worth your while taking some time to go through the Java tutorial - taking the time to understand how the language works before getting too far into coding is a good thing!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!