+ 1
What is the difference between these two codes in getting User Input in #java?
https://code.sololearn.com/c4391YB9pN5F/?ref=app https://code.sololearn.com/cM2PEew2bcRm/?ref=app
4 Answers
+ 1
Nothing much, you just define the string earlier or later, but it both works
+ 5
For one the scanner object is being initialized on creation of the class, the other is when ran in the main method.
Both scanners are global objects in these examples.
+ 1
@Maart Thanks! I am gratefull to you!
+ 1
@Restoring faith, I appreciate it dude!