Ask your own question, for FREE!
Mathematics 11 Online
OpenStudy (anonymous):

how to input a string variable in java? can anyone help me with this

OpenStudy (kainui):

Do you mean you want to declare a string variable or you want anyone to run your java program and input a string?

OpenStudy (anonymous):

i am a begineer and i just want to input a string and run the program

OpenStudy (anonymous):

will you please help me out

OpenStudy (kainui):

Try this: `new String myStringName = "Hello there!";`

OpenStudy (anonymous):

thank you

OpenStudy (anonymous):

input "enter the character =",a where "a" is a string i have done this many times in q basic but how to do this in java

OpenStudy (kainui):

``` InputStreamReader in = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(in); System.out.println("Enter String: "); String enteredString = null; try { enteredString = reader.readLine(); } catch (IOException e) { e.printStackTrace(); } System.out.println(enteredString); ``` So that's pretty complicated, but it should give you what you want. I can explain anything that you can't figure out by playing with it for a few seconds.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!