Rohit wrote:
The following piece of code compiles well using the JCompiler plugin to
Ok... here's my chance to nitpick ;)
import java.io.*;
import java.io.BufferedReader; import java.io.InputStreamReader; /* import specific classes */
class HelloWorld { public static void main(String args[]) { try { BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
String s=" ",s1=" "; System.out.print("Enter your string : "); s1=buf.readLine(); s+=s1;
/* could well have been... */ System.out.print("Enter your string : "); String s = buf.readLine(); /* why s, s1? and why initialise to " " ? */
buf.close(); System.out.println("Your string is : "+s); } catch(Exception e){}
You never want to do that in production code. An exception has occured, deal with it. Even in this test case, you probably want to e.printStackTrace() it. At least it might help debug/solve your problem.
} }
However when i try to run this program thru java command of Console plugin of Jedit ,it hangs out and i do not get any o/p.
What do you mean it hangs out? Does it prompt you for input? What happens when you hit [enter] after entering the string?
You'll be lucky if there are any jedit users here. Otherwise it might be worth to just use the command line instead.
-Manish