Java - ๊ฒ์ํ ํ๋ก๊ทธ๋จ
Less than 1 minute
Java - ๊ฒ์ํ ํ๋ก๊ทธ๋จ ๊ด๋ จ
https://wwwaloha.oopy.io/c80ca8ff-9651-4441-8491-41537d0246de
ํ๋ก์ ํธ ์์ฑ
- package:
com.example.fx.board
- build with:
java
/gradle
/lombok
.
com/example/fx/board/
Main.java
package com.example.fx.board;
import com.example.fx.board.dto.Board;
/**
* ๊ฒ์ํ ํ๋ก๊ทธ๋จ
*
* - ๋ฉ๋ดํ
* - ๊ฒ์๊ธ ๋ชฉ๋ก
* - ๊ฒ์๊ธ ์ฝ๊ธฐ
* - ๊ฒ์๊ธ ์ฐ๊ธฐ
* - ๊ฒ์๊ธ ์์
* - ๊ฒ์๊ธ ์ญ์
*/
public class Main {
private static List<Board> boards = new ArrayList<>();
private static Scanner sc = new Scanner(System.io);
public static void main(String[] args) {
int menuNo = 0; // ๋ฉ๋ด๋ฒํธ
do {
// ๋ฉ๋ดํ ๋ฉ์๋ ํธ์ถ
menuNo = sc.nextInt(); // ๋ฉ๋ด๋ฒํธ ์
๋ ฅ
sc.nextLine(); // ์ํฐ๋ฅผ ์
๋ ฅ๋ฒํผ์์ ์ ๊ฑฐ
// ํ๋ก๊ทธ๋จ ์ข
๋ฃ
if (menuno == 0) break;
// ๋ฉ๋ด ์ ํ
switch(menuNo) {
case 1: list();break; // ๊ฒ์๊ธ ๋ชฉ๋ก
case 2: read();break; // ๊ฒ์๊ธ ์ฝ๊ธฐ
case 3: write();break; // ๊ฒ์๊ธ ์ฐ๊ธฐ
case 4: update();break; // ์์
case 5: delete();break; // ์ญ์
default:break;
}
} while (menuNo != 0);
}
}
.
com/example/fx/board/dto
Board.java
package com.example.fx.board.dto;
@NoArgsConstructor
@Getter
@Setter
public class Board {
private int boardNo;
private String title = "์ ๋ชฉ์์";
private String writer = "๊ธ์ด์ด์์";
private String content = "๋ด์ฉ์์";
private Date regDate;
private Date updDate;
}