Hi there I am reading some java tutorial and a have a question about these 2 classes java.util.Scanner; javax.swing.JOptionPane;
In the tutorial I am looking at the 2 classes are used in separate programs to get the input from a user
With the first class http://www.homeandlearn.co.uk/java/user_input.html after importing the class we create a new object:Scanner user_input = new Scanner( System.in );
and then move on and get the input from the user
But if we want to use the second class as in here http://www.homeandlearn.co.uk/java/java_option_panes.html, no object is created we use it directly with a nethod without creating an instance showInputDialogue()
:
String first_name;
first_name = JOptionPane.showInputDialog("First Name");
Why is that? I thought that a class on its own doesn't do anything till we create an instance of the object. Please bear in mind this is my second lesson of java, so I might be missing something really obvious here