methods to enter input in java....?? | Sololearn: Learn to code for FREE!


methods to enter input in java....??

system.out.println is used for we enter input ???

2/5/2017 4:13:06 PM


5 Answers

New Answer


//First import scanner: import java.util.Scanner; //then make an instance of it: Scanner cin = new Scanner(; //then use it to get user input : String text = cin.nextLine();


Hi, there is the Scanner class for input. You have to create an object: Scanner input = new Scanner(; then you can use it like this: String var = input.NextLine();


U can also use the Buffered Reader object. Ask me if u wanna know.


thnkuu all of you....uhh helped me alot


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