Hello!
I am quite new to programming in Java so I have difficulty trying to grasp why things work the way they do and such. This question is about the use of static for the declaration of an object. I attach the code below:
Can someone explain to me why it is done that way and the advantages? Thanks a lot.public class Main { private static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { System.out.println("Type in:"); int count = scanner.nextInt(); scanner.nextLine(); }
Regards.
Hector_M