+ 1
how can we in most basic way put our input into Java code, can we write like this is not pls tell system.scanf(n);
6 Answers
+ 3
for geting input from user we can use scanner class.
i learnt in netbeans.
acording to tat i wil tel u wat i do..
frst type import java.util.*; (below package).
(v must do this first to use scanner class.)
then type
Scanner s=new Scanner(System.in);
System.out.println("enter n:") //input n
int n=s.nextInt(); //for accepting ur integer value
System.out.println(+n); //to display n
u can creat scanner clas lik how i did n iput values..
hope u can understand....sorry if i confused u...
+ 1
hey this is how i do to get d input.
+ 1
yes lik tat if u need a string to be ur input u can use next();
or for double
nextDouble();
it goes lik tat...
0
man want I want to is how to take given input value
0
hey where did this "nextlnt" come from and it's meaning
0
nextInt () is a method of the scanner class, it basically says thats its getting an integer input from the user