
int 변수 선언 후 임의로 값을 넣음. 해당 값이 짝수 이면 "짝수 입니다" 출력 해당 값이 홀수 이면 "홀수 입니다" 출력 public class PraybeBlog { public static void main(String[] args) { int n =2343257; if(n % 2 == 0 ) System.out.println(n + "은(는) 짝수입니다."); else if (n % 2 == 1) //else 라고 적어도 됨 System.out.println(n + "은(는) 홀수 입니다."); } }

switch 문에서 아래의 프로그래밍을 짜시오. 1234 월 봄입니다.출력 5678 월 여름입니다.출력 9 10 11 12 월 겨울 입니다. 출력 public class PraybeBlog { public static void main(String[] args) { int n = 2; switch (n) { case 1,2,3,4: System.out.println("봄 입니다."); break; case 5,6,7,8: System.out.println("여름 입니다."); break; case 9,10,11,12: System.out.println("겨올 입니다."); break; default: System.out.println("찾을 수 없습니다."); break; } } }

국영수 총점 평균 및 수우미양가출력 public class PraybeBlog { public static void main(String[] args) { int kor = 86; int eng = 97; int math = 64; //국영수 총점 평균 int total = kor + eng + math; double avg = total / 3.0; System.out.println("총점: "+ total); System.out.println("평균: "+ avg); //수우미양가출력 if(avg >=90) { System.out.println("수 입니다."); } else if (avg >= 80) { System.out.println("우 입니다."); }else if (avg >= 70) { ..

11 이 1초과 100 미만의 숫자인가? 22 가 2의 배수 또는 3의 배수 숫자인가 ? true false로 위의 결과를 나타내시오. public class PraybeBlog { public static void main(String[] args) { int n = 11; int i = 22; boolean result; //변수 n에 저장된 값이 1과 100사이의 수인가? result=(1

아래를 프로그래밍 하시오. 국어 : 50 영어 : 70 수학 : 95 총점과 평균을 구하시오. -단 평균은 소숫점 까지 나오도록 하시오 public class PraybeBlog { public static void main(String[] args) { int kor, eng, math; kor = 50; eng = 70; math = 95; int total = kor + eng + math; double avg = total/3.0 ; System.out.println("총점: " + total); System.out.println("평균: " + avg); } }

원의 반지름 5.6을 담는 변수 선언, PI 상수로 선언, 원의 넓이 공식 πr^2(파이알의 제곱)을 담는 변수를 선언하여 넓이를 담고 출력 public class PraybeBlog { public static void main(String[] args) { double radius = 5.6; final double PI = 3.14; double area = radius * radius * PI; System.out.println(area); } }

100과 200을 담는 변수 두 개를 선언 후, 두 수의 합의 결과를 담는 변수를 선언하여 해당 두 수의 합을 출력하는 프로그램 public class PraybeBlog { public static void main(String[] args) { int n = 100; int i = 200; int sum = n + i; System.out.println(sum); } } 3.14와 5.14를 담는 변수 두 개를 선언 후, 두 수의 곱의 결과를 담는 변수를 선언하여 해당 두 수의 곱을 출력하는 프로그램 public class PraybeBlog { public static void main(String[] args) { double n = 3.14; double i = 5.14; double sum =..

1. Object클래스의 11개 함수를 나열해 보시오. Object 클래스란? 모든 클래스의 최상위 클래스이자 부모 클래스이다. 함수명 메소드 용도 equals( ) ★ public boolean equals(Object obj) { } 객체동등비교 (주소값비교) hashCode( ) ★ public int hashCode( ) 객체 해시코드 값 리턴 toString( ) ★ public String to String( ) { } 객체 문자열 정보 clone( ) Shallow Deep 객체복사 (얕은복사, 깊은복사) finalize( ) protected void finalize( ) throws Throwable { } 객체 소멸, jvm이 호출 getClass( ) Class getClass( ) ..