- 매개 변수
글번호 : num
글쓴이 : wirter
제목 : subject
내용 : content
날짜 : enterDate
public class Board {
int num; // 글 번호
String writer; // 글쓴이
String subject; // 제목
String content; // 내용
String enterDate; // 날짜
public Board() {}
public void setNum(int num) {
this.num = num;
}
public int getNum() {
return this.num;
}
public void setWriter(String writer) {
this.writer = writer;
}
public String getWriter() {
return this.writer;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getSubject() {
return this.subject;
}
public void setContent(String content) {
this.content = content;
}
public String getContent() {
return this.content;
}
public void setEnterDate(String enterDate) {
this.enterDate = enterDate;
}
public String getEnterDate() {
return this.enterDate;
}
}
public class BoardTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
Board board = new Board();
board.setNum(1);
board.setWriter("이현경");
board.setSubject("안녕");
board.setContent("안녕하세요 이현경입니다~~");
board.setEnterDate("2021-04-16");
System.out.println("글 번호 : " + board.getNum());
System.out.println("글쓴이 : " + board.getWriter());
System.out.println("제목 : " + board.getSubject());
System.out.println("내용 : " + board.getContent());
System.out.println("날짜 : " + board.getEnterDate());
}
}
- 실행 결과