Docker Image (이미지)
도커에서 서비스 운영에 필요한 서버 프로그램, 소스코드 및 라이브러리, 컴파일된 실행 파일을 묶는 형태를 Docker Image라한다. 다시 말해, 특정 프로세스를 실행하기 위한(즉, 컨테이너 생성(실행)에 필요한) 모든 파일과 설정값(환경)을 지닌 것
private, getter, setter
private : 마음대로 바꾸지말고, 생긴대로 사용좀 해
setter는 어차피 값 설정만 하는 것이므로 return 값이 불필요 + void를 변수 선언시 같이 한다.
반대로 getter는 값을 가져오니까 return이 필요하다
public void setTitle(String title){
this.title=title;
}
public String getTitle() {
return title;
}
Error-log : docker-credential-desktop not installed or not available in PATH
C:\Users\[컴퓨터 유저이름]\.docker
이 경로로 접속해서 config.json에 들어있는"credsStore" : "desktop" 값을 삭제한다
오늘의 퀴즈
- 최대값max는 int니까 asInt로 get해주고, 평균은 소수점을 기본적으로 포함해서 getAsInt는 안되고, Double로 획득 가능
getAsInt나 getAsDouble 처리 안해주면 깔끔하게 처리가 안된다.
자바는 출력할 때 이런 문제가 자주 발생하는 듯 하다
System.out.println(Arrays.stream(scores).max().getAsInt());
System.out.println(Arrays.stream(scores).average().getAsDouble());
- 배열 선언하고 나중에 초기화 하려면. 이렇게 null로 지정해줘야 한다. 그냥 int[] scores;하고 끝나면, 에러발생함(초기화가 아마 안된것같다고 하면서)
int[] scores = null;
- 그리고 초기화 할 때는 다음과 같이 작성한다.
다른 예제에서 new array[number] 이런식으로 되있어서 따라했다가 안됐는데, 아래처럼 하니까 해결 되었음.
scores = new int[studentNum];
- 전체코드
import java.util.Arrays;
import java.util.Scanner;
public class study0602 {
public static void main(String[] args) {
boolean run = true;
int studentNum = 0;
int[] scores = null;
Scanner sc = new Scanner(System.in);
while (run) {
System.out.println("--------------------------------------------------------");
System.out.println(" 1. 학생수 | 2. 점수입력 | 3. 점수리스트 |4. 분석 | 5. 종료");
System.out.println("--------------------------------------------------------");
System.out.println("선택> ");
int selectNo = sc.nextInt();
if (selectNo == 1) {
System.out.println("학생수> ");
studentNum = sc.nextInt();
scores = new int[studentNum];
}else if (selectNo == 2) {
// 작성위치
for (int i=0; i<studentNum; i++) {
System.out.println("scores[" + i + "]> ");
scores[i] = sc.nextInt();
}
}else if (selectNo == 3) {
for (int i = 0; i < studentNum; i++) {
System.out.println("scores[" + i + "]: " + scores[i]);
}
} else if (selectNo == 4) {
System.out.println("최고점수");
System.out.println(Arrays.stream(scores).max().getAsInt());
System.out.println("최저점수");
System.out.println(Arrays.stream(scores).average().getAsDouble());
} else if (selectNo == 5) {
run = false;
}
}
System.out.println("프로그램 종료");
}
}
'TIL WIL' 카테고리의 다른 글
WIL 7th (0) | 2022.06.08 |
---|---|
20220603 TIL (0) | 2022.06.07 |
20220531 TIL (0) | 2022.05.31 |
20220530 TIL (1) | 2022.05.31 |
WIL 6th (1) | 2022.05.30 |