iluvthee07
iluvthee07

Reputation: 501

Accepting User Input in Java

Is it possible to add C++ like input (i.e. without using Scanners or anything; just plain single statement input like "cin>>") in Java using some library or anything?

Upvotes: 0

Views: 616

Answers (3)

Philipp Sander
Philipp Sander

Reputation: 10249

No. It's not that easy because Java does not support operator overload

you can create a Scanner object

Scanner scan = new Scanner(System.in);

and read the user input with

String s = scan.readLine();

Upvotes: 2

nano_nano
nano_nano

Reputation: 12523

Briefly... No. Use the scanner:

Upvotes: 0

Kayaman
Kayaman

Reputation: 73548

You can't have operator overloading and Scanner is in the standard library.

Upvotes: 0

Related Questions