次のコードはBatesとSierraからのものです。
public class Book {
private String title; // instance reference variable
public String getTitle() {
return title;
}
public static void main(String [] args) {
Book b = new Book();
String s = b.getTitle(); // Compiles and runs
String t = s.toLowerCase(); // Runtime Exception!
}
}
String t = s.toLowerCase()
実行時例外が発生しないのに、なぜ発生するのString s = b.getTitle()
ですか?