Questions 1
What is the difference between the following 2 declaration statements?

char option;
option = 'C';

and

char option='C';


Questions 2
Why sometimes we initialize variables and sometimes we don’t?
For example in the following program, we initialized the string name,
but we did not initialize the string msg:

1 import javax.swing.JOptionPane;
2
3 public class GetInputFromKeyboard {
4
5 public static void main( String[] args ){
6 String name = "";
7 name=JOptionPane.showInputDialog(“Please enter your name");
8 String msg = "Hello " + name + "!";
9 JOptionPane.showMessageDialog(null, msg);
10 }

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to