0

how do i input in Java? like cout << in C++

java

2nd Jul 2016, 12:51 AM
d.oremi03 d.oremi03
d.oremi03 d.oremi03 - avatar
6 Answers
+ 2
import java.util.scanner; class input { public static void main(String args []){ //this line will take in put Scanner myVariable = newScanner (System.in); } }
3rd Jul 2016, 4:48 PM
Jeremiah Rousseau
Jeremiah Rousseau - avatar
+ 1
shipra why not use scanner ?
2nd Jul 2016, 11:09 AM
Vipul Bisht
Vipul Bisht - avatar
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 */
2nd Jul 2016, 2:36 AM
Shipra Chordia
Shipra Chordia - avatar
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()
2nd Jul 2016, 4:55 AM
Dwayne Barsotta
Dwayne Barsotta - avatar
0
What do you mean between cout and cin?
5th Oct 2016, 5:59 AM
Very hard!
Very hard! - avatar
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!
3rd May 2018, 8:19 AM
Vipul Bisht
Vipul Bisht - avatar