0
What does the "new" keyword do?
Scanner myVar = new Scanner(System.in); //new? why?
4 ответов
+ 6
In C++ 'new' keyword is used to create dynamic variables or containers. These dynamic variables are created on heap. The most important thing is that you need to delete the dynamic variables after their use in a program using keyword 'delete' otherwise you will have a memory leak issue
+ 4
Firstly next time explicitly say what language you are talking about or put it in the tags. The new keyword in Java is used to tell the language to create a new object, in this case create a Scanner object that will take/scan user input when specified hence "Scanner".
+ 2
what language
0
Thanks guys.