자바 오류 질문
-
게시물 수정 , 삭제는 로그인 필요
자바 이클립스에서 이거 왜 안될까요
이렇게 오류가 떠요
Thread [main] (Suspended (uncaught exception NullPointerException))
Book.main(String[]) line: 13
import java.util.Scanner;
public class Book {
String title, author;
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
Book[] book = new Book[2];
for(int i=0; i<book.length; i++) {
System.out.print("제목과 저자를 입력하세요");
book[i].title =scanner.nextLine();
book[i].author =scanner.nextLine();
}
for(int i=0; i<book.length; i++) {
System.out.print("(" + book[i].title + ", " + book[i].author + ")");
}
}
}
import java.util.Scanner;
public class Book {
String title, author;
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
Book[] book = new Book[2];
for(int i=0; i<book.length; i++) {
System.out.print("제목과 저자를 입력하세요");
book[i].title =scanner.nextLine();
book[i].author =scanner.nextLine();
}
for(int i=0; i<book.length; i++) {
System.out.print("(" + book[i].title + ", " + book[i].author + ")");
}
}
}
#자바 오류 #자바 오류코드 1603 #자바 오류코드 1618 #자바 오류 종류 #자바 오류 처리 #자바 오류 해결 #자바 오류 발생시키기 #자바 오류코드 #자바 오류 메시지 #자바 오류 찾기