0
how do i input in Java? like cout << in C++
java
6 ответов
+ 2
import java.util.scanner;
class input {
public static void main(String args []){
//this line will take in put
Scanner myVariable = newScanner (System.in);
}
}
+ 1
shipra why not use scanner ?
0
import java.io.*;
class Input {
public static void main (String args [])
{
Console con = System.console();
String str;
str = con.readLine ();
}
}
/*there are other methods too */
0
to print to the terminal line use system.printin();
I thought cout men's to out put? either way system.println() or system.readline()
0
What do you mean between cout and cin?
0
it's really easy if you just want to do a simple input from a user
import.util.Scanner;
class Hello{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in)
sc. nextLine();
}}
With this code you can easily input a line from the user. Hope it helped you .just give an update if it helped anyone!