Hello All:
What will be the output of the following code:
public class Book{
private String title;
public String getTitle() {
return title;
}
public static void main() {
Book b = new Book();
System.out.println("The title is " + b.getTitle());
}
}
The book I am reading says: The title is null
Does that mean, the default value of the class String is interpreted as string "null". Or, is there soem explicit conversion during the execution of + operator of the String class??
I thought the output should be: The title is
[ August 16, 2003: Message edited by: Brit Wright ]
What will be the output of the following code:
public class Book{
private String title;
public String getTitle() {
return title;
}
public static void main() {
Book b = new Book();
System.out.println("The title is " + b.getTitle());
}
}
The book I am reading says: The title is null
Does that mean, the default value of the class String is interpreted as string "null". Or, is there soem explicit conversion during the execution of + operator of the String class??
I thought the output should be: The title is
[ August 16, 2003: Message edited by: Brit Wright ]