+ 7
How can I get user input and perform operations on it?
Java
4 Answers
+ 20
operations may vary depending on datatype & what operations u want to perform , here is how to take user input ☺👍
https://www.sololearn.com/learn/Java/2220/?ref=app
+ 15
Use Scanner class
For getting Integer form user use this method from Scanner Class
Suppose we have created a scanner object and give that name is obj
int a = obj.nextInt();
For float
float a =obj.nextFloat();
for String
String a =obj.nextLine();
+ 3
you can use "Scanner" or "BufferedReader "or simply you can do
public static void main (int n)
{
//some coding.
}
0
hello