Hi, When i executed the below code, ----------------------- public class A{ public static void main (String[] args) { String s1 = null; // 3 String s2 = new String(); // 4 String s3 = new String(); // 5 System.out.print(s1); // 1 System.out.print(s2); // 2 } } ------------------------- Output will be null(for line number 1 ) and there is no output for line number 2. Can any of you explain me the difference, between declaring the string object on line numbers 3, 4 and 5. When can i use the reference of each these, can you explain me with the examples.. Thanks in Advance... Narasimha. [ May 16, 2003: Message edited by: narasimha rao bandlamudi ]
Narasimha
Ryan Wilson
Ranch Hand
Joined: Apr 16, 2003
Posts: 64
posted
0
narasimha
String public String()Initializes a newly created String object so that it represents an empty character sequence.