Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Noob64668yA friend of mine is a C++ programmer. He was so confused when he tried to get basic user input in Java.
-
Noob64668y@RazorSh4rk yeah, well those two languages are different in so many things.
What my friend was confused about is that theres no "native" input command but the need to import a scanner class, instantiate it, open, receive valid input and then close it. -
@Noob it's also possible via System.console().readLine(); and because it's Java, there are also 7 other ways, out of which 5 are deprecated and 3 are considered unsafe
C++ on the other hand has std::cin and std::getline, which both serve different purposes and are much more flexible -
@hoggchan you didn't get it.
but, Java dev:
int x = 2;
String y = "hello";
that would be enough at the very most of the time.
Related Rants
JS Developer :
var x = 2
x = "hello"
Java developer:
what the hell !!
undefined
java
javascript