티스토리 뷰
1. Book의 인스턴스 b1, b2를 각각 생성하고 위 표의 있는 값을 Book의 매개 변수에 넣은 후 printInfo 메소드를 활용하여 출력하세요.
변수명 | isbn | author | title | publisher |
b1 | 978-89-123456-0-1 | William Shakespeare | Hamlet | Good Books |
b2 | 978-89-234567-0-9 | Miguel de Cervantes | Don Quixote | Literature World |
class Book {
String isbn;
String author;
String title;
String publisher;
void printInfo(){
System.out.println("ISBN : " + isbn + "\nauthor : " + author + "\ntitle : " + title + "\npublisher : " + publisher + "\n");
}
Book(String isbn, String author, String title, String publisher) {
this.isbn = isbn;
this.author = author;
this.title = title;
this.publisher = publisher;
}
}
public class Main {
public static void main(String args[]) {
Book b1 = new Book("978-89-123456-0-1", "William Shakespeare","Hamlet", "Good Books");
b1.printInfo();
Book b2 = new Book("978-89-234567-0-9","Miguel de Cervantes", "Don Quixote", "Literature World");
b2.printInfo();
}
}
'JAVA' 카테고리의 다른 글
웹사이트 여러가지 태그 (0) | 2023.10.04 |
---|---|
웹사이트 제작(HTML) (0) | 2023.10.03 |
붕어빵 (0) | 2023.09.24 |
항공기 운행 (0) | 2023.09.24 |
좌석 번호 (0) | 2023.09.24 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 영어
- mysql
- Programming
- 영어회화
- 클래스
- 경제신문
- python
- 보안
- 자바
- 모듈
- 경제
- sql
- plot
- 함수
- 금리
- 코딩테스트
- 데이터분석
- 코딩
- 머신러닝
- 그래프
- R
- 코드
- 개발
- 프로그래밍
- SW
- 프로그래머스
- 코테
- 파이썬
- 데이터
- 스마트워치
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
글 보관함