+ 5

hello guys this java code seems not to be working on netbeans and eclipes IDE .

import java.util.Scanner; class MyClass { public static void main(String[] args) { Scanner myVar = new Scanner(System.in); System.out.println(myVar.nextLine()); } } The Program wont even run guys please i need your help on this

22nd Dec 2017, 6:05 AM
Franklyn Omeben
Franklyn Omeben - avatar
8 Respostas
+ 30
it compiles on my side. Please show the error what you have
22nd Dec 2017, 8:52 AM
Ghena Ramascan
Ghena Ramascan - avatar
+ 19
u can use "text fields" or "text boxes" & many more components to take user input //in IDE's (netbeans)
22nd Dec 2017, 8:08 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 8
What is the error? Did you install the JDK on your system?
22nd Dec 2017, 6:13 AM
ChaoticDawg
ChaoticDawg - avatar
+ 6
That's because it is waiting for user input. Notice the blinking caret (a.k.a. cursor) in the console window?
24th Dec 2017, 3:48 PM
David Fuqua
David Fuqua - avatar
+ 3
but however other code runs fine
22nd Dec 2017, 11:53 AM
Franklyn Omeben
Franklyn Omeben - avatar
+ 2
thats the problem it shows no error , when i type the code and click run it just keep running but it shows no output nor errors and when i click stop it says BUILD STOPPED (total time: 16 minutes 46 seconds)
22nd Dec 2017, 11:53 AM
Franklyn Omeben
Franklyn Omeben - avatar
0
You are trying to print a string from the user, so while running you need to enter a text then hit enter. The program should print it out.
22nd Dec 2017, 7:32 PM
Lee
0
Perhaps you don't have the JDK installed? My favorite IDE is BlueJay, I tend to have fewer issues on the runtime side with it than other IDE's.
23rd Dec 2017, 12:59 AM
Mohamed
Mohamed - avatar