【♣부트 캠프♣】/▷부캠- 에러 모음19 [24.05.28-8일차] 허리인치를 기입안했다고.. http://www.samsunghospital.com/home/healthInfo/content/contenView.do?CONT_SRC_ID=27845&CONT_SRC=HOMEPAGE&CONT_ID=3570&CONT_CLS_CD=001021005001▲ ▲ ▲ ▲ 허리수치 구하는 방법 링크 ▲ ▲ ▲ ▲ ▲ ▲ 내 체중은 정상인가요?날이 갈수록 늘어나는 체중, 체중이 정말 늘어난건지 체중계가 고장난건지 속상하기만 합니다. 예전엔 홀쭉하던 내가 어느새 뱃살이 팽팽한 과체중이라고 합니다. 조금 있으면 비만이 되겠www.samsunghospital.com public void cnt2() { System.out.println("성별?[m/w]"); r1.gender =sc.next(); .. 2024. 5. 28. [24.05.27-7일차] public void input() {//input(매개변수 비어도돼) Scanner sc = new Scanner(System.in); int w,h;// 지역변수로 설정되어있어서 값 인식이 안됨 ㅠㅠ System.out.println("가로?");//10 w =sc.nextInt(); System.out.println("세로?");//20 h =sc.nextInt(); //return; void는 안 써도 돼 } ▶해결: import java.util.Scanner;public class Rect { int w,h;//복도에 빼놓은 물통 전역변수(글로벌변수)=인스턴스 변수 public void input() {//input(매개변수 비어도돼) Scanner sc =.. 2024. 5. 27. [24.05.24-6일차] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at com.day6_ex_1.Test1.main(Test1.java:19) 원인: 범위초과 public static void main(String[] args) { //1. 5개의 정수를 배열에 입력받아 입력받은 수를 출력하고 입력받은 수중 // 가장 큰수와 적은수를 출력-어떻게 출력해? selection sort ->인덱스0값이랑 4값호출 //선언부 Scanner sc = new Scanner(System.in); int num[] = new int[5]; int i; //입력부 System.out.println("숫자 5개?"); for(i=0; i ▲Ex.. 2024. 5. 24. [24.05.23]-5일차 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at cohttp://m.day5.Test1.main(Test1.java:26)for(int i=0;i {// i→배열에서 인덱스는 사람이 생각하는 n-1이다. Exception in thread "main" java.lang.Error: Unresolved compilation problems: i cannot be resolved to a variable i cannot be resolved to a variable i cannot be resolved to a variable i cannot be resolved to a variable at com.day5_ex1.Te.. 2024. 5. 23. [24.05.22] Exception in thread "main" java.lang.Error: Unresolved compilation problems: num cannot be resolved to a variable//입력받은 수가 3의배수 or 4의 배수인지 찾으시오. 혼공 Scanner sc= new Scanner(System.in);//입력받기위해서scanner사용 int num1; //입력은 하나만 받는다. String str; //"3의 배수다" 적기위한 선언 System.out.println("한개의 수를 입력해라");//9입력 num1= sc.nextInt(); // 여기 안들어가네 쩝 str = sc.next(); if(num1%3==0 && num1%4==0) { str .. 2024. 5. 22. [24.05.21] 코드리뷰+에러모음 선언부를 입력 잘 못함 public static void main(String[] args) { //Q1.정수를 입력 받아서 짝수, 홀수를 구별해서 출력. //선언부 Scanner sc= new Scanner(System.in); String str; int num1; //입력부 System.out.println("홀짝인지 정수 입력하시오."); num1 = sc.nextInt();// "짝수 홀수 쓰려면 str 정의랑, num정의 따로해야함 // 정수 입력 받는부분 뭐써야할지 몰랐음 //연산 및 출력 str = (num1%2==0) ? "짝수":"홀수"; System.out.println(str);public static void main(String[] args) { //선언 Scanne.. 2024. 5. 22. 이전 1 2 3 4 다음