Guys I need your help. I am doing an online degree in computer science and I am a naive programmer. I have been introduced to NetBeans 7.2 but i am unable to get user-input because its not a built in function. could you please teach the simplest way to get a user-input in netbeans 7.2??
well are u using netbeans for Java
Would like to share the code with us, i have an idea what you r talking about.
ok not sure if this answer is right but this is how i wired up my input from the keyboard.. System.out.println("(press Enter to exit)"); // This is the code to delay ending the input try { System.in.read(); // Read some input from the keyboard } catch (IOException e) //Catch the input exception { return; // and just return } // it simple just returns whatever you enter with the keyboard.
well this looks like it is in Java so you would have to add this line on the top before the main import java.util.Scanner then you would put Scanner input = new Scanner(System.in); before the System.out.println("");
Well NetBeans does not only support java but in such case yes @ jasd33p11 have your answer. the Syntax is: import java.util.Scanner; Scanner variable_name_for_user_input = new Scanner(System.in); //that is your scanner object string variable; variable = variable_name_for_user_input.newLine();
Join our real-time social learning platform and learn together with your friends!