private static Scanner sc;
&
sc.close();
What is the difference between these two things?
private static Scanner sc;
&
sc.close();
What is the difference between these two things?
These two concepts are unrelated. According to the Java documentation:
The private modifier specifies that the member can only be accessed in its own class.
See this thread to learn about Scanner.close()
.