We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
What it's doing is looking at the "Scanner" class which acts as a blueprint for new instance of the class also known as objects. The new keyword is creating a new object somewhere in memory. Then a reference variable is created that points to that object's location in memory "scan". "scan" is not itself an object, though it's simpler to think of it as such. Lastly it is of type "Scanner", since Scanner is the class it comes from.
(Source) - am a .js engineer, and have been attending a "Learn Java" course all week - the above is what the teacher has drilled into our heads. The teacher was @ Sun Microsystems when they were creating Java - so knows his stuff!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Stdin and Stdout I
You are viewing a single comment's thread. Return to all comments →
What it's doing is looking at the "Scanner" class which acts as a blueprint for new instance of the class also known as objects. The new keyword is creating a new object somewhere in memory. Then a reference variable is created that points to that object's location in memory "scan". "scan" is not itself an object, though it's simpler to think of it as such. Lastly it is of type "Scanner", since Scanner is the class it comes from.
(Source) - am a .js engineer, and have been attending a "Learn Java" course all week - the above is what the teacher has drilled into our heads. The teacher was @ Sun Microsystems when they were creating Java - so knows his stuff!