Hi Sang,

I encountered two questions when I was working on the lecture 2 materials
of the course.

1) The two classes BufferedReader & JOptionPane

I noticed that these two classes are used in different ways in the two
example programs.  A new instance is created before BufferedReader method
is employed.   It is illustrated as follows:


*BufferedReader dataIn = new BufferedReader(new InputStreamReader(
System.in) );*
*String name = dataIn.readLine(); // readLine method is called from the
instance of BufferedReader.*


However, in the example of JOptionPane, it is written as ths:


*String name=JOptionPane.showInputDialog("Please enter your name"); *
*// No instance is created.  Method showInputDialog is called directly from
the class JOptionPane.*


So my question is why are they different?  What is an instance is not
created in JOptionPane's case?

2) In the lab of "Getting input from keyboard", there is one extra line in
the JOptionPane example:


*public class InputFromKeyboardJOptionPane {*
*     *
*    /** Creates a new instance of InputFromKeyboardJOptionPane */*
*    public InputFromKeyboardJOptionPane() {*
*    }*
*     *

What is the purpose of creating this self instance of
InputFromKeyboardJOptionPane?  It is not explained in the lecture pdf note.

Thanks in advance.
 Cheers,
Angela

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to