Mindy,
A String is a collection of charecters (just like the literal meaning of the word-"String"
eg:- "a String of charecters"). And char is a single letter or a number.
In Java, char is called a primitive datatype, whereas a String is a
class. char occupies 16 bits(2 bytes), and must have its literal(i.e-the letter or number you use) enclosed in single quotes('')....eg-
char ch = 'A'; A String on the other hand is always enclosed in double quotes(""). And when you do
String str="This is a new string";, you are actually creating a reference variable
str pointing to an object with "This is a new string" in it.
When you create char or String as instance variables in your program, then char is initialized to '\u0000' (something of not much use
) and a String variable being a object reference is initialized to
null.
Hope this helps
Rebecca