0
methods to enter input in java....??
system.out.println is used for output...how we enter input ???
5 Respostas
+ 5
//First import scanner:
import java.util.Scanner;
//then make an instance of it:
Scanner cin = new Scanner(System.in);
//then use it to get user input :
String text = cin.nextLine();
0
Hi, there is the Scanner class for input. You have to create an object: Scanner input = new Scanner(System.in); then you can use it like this: String var = input.NextLine();
0
U can also use the Buffered Reader object. Ask me if u wanna know.
0
thnkuu all of you....uhh helped me alot
- 1
The last code line the posters above answered "String var = input.NextLine(); "depends on the varibale eg if its double, it will be =input.nextDouble and so on