java(472)
-
SwitchEx02.java-switch문에 문자 비교
switch문에 문자 비교 소스코드 public class SwitchEx02 { public static void main(String[] args) { //char a = 'A'; //char a = 'B'; char a = 'C'; //char a ='D'; switch(a){ //char -> int 형변환 됨(아스키 코드로 인식됨) case 'A': System.out.println("A 출력하였습니다."); break; case 'B': System.out.println("B 출력하였습니다."); break; case 'C': System.out.println("C 출력하였습니다."); break; default: System.out.println("A, B, C가 아닌 문자 입니다."); }..
-
Error-Problems occurred while trying to save the state of the workbench
오류메시지 Problems occurred while trying to save the state of the workbench. Could not write metadata for '/.org.eclipse.jdt.core.external.folders'. C:\javanAndroid\workspace_android\.metadata\.plugins\org.eclipse.core.resources\.projects\.org.eclipse.jdt.core.external.folders\.markers (지정된 경로를 찾을 수 없습니다) 해결방법 workspace폴더안의 .metadata 폴더 삭제 후 이클립스 재시작
-
SwitchEx01.java-switch문에서 정수 비교하기
switch문에서 정수 비교하기 소스코드 출력결과 소스코드 public class SwitchEx01 { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); int a; System.out.print("정수형 숫자를 입력하세요 > "); a = input.nextInt(); switch(a){// JDK v6: long을 제외한 정수형(byte, short, int), char case 1: System.out.println("1 입력하였습니다."); break; case 2: System.out.println("2 입력하였습니다."); break; case 3: System...
-
IfEx02.java-단일 if
조건문 - 단일 if (정수형 입력 받은 후 짝수 홀수 구분하기) 소스코드 public class IfEx02 { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); int a; System.out.print("정수형 데이터 하나를 입력 > "); a = input.nextInt(); if(a%2 == 1){ //홀수 체크 System.out.print("홀수 입니다."); }else{ // 짝수 System.out.print("짝수 입니다."); } } } 출력결과
-
시스템 환경변수 등록하기, Java 컴파일 환경 구성, Path설정 (eclipse IDE 사용을 위한)
eclipse를 이용하지 않고 직접 컴파일 할 경우 환경 설정 - Standards 작업절차 JDK 설치경로 확인 시스템 환경 변수 등록 시스템 변수 등록-JAVA_HOME (JDK설치 경로 지정) 시스템 변수 등록-Path 지정 (JDK의 실행파일 등록) 시스템 변수 등록-CLASSPATH (사용하는 클래스의 현재 디렉토리 등록) java환경변수 정상 등록 확인하기 JDK 설치경로 확인 C:\Program Files\Java\폴더 안에 JDK가 설치되어 있습니다. C:\Program Files\Java\jdk1.8.0_05 JDK경로를 시스템 변수로 등록하기 시작 > 컴퓨터 > 마우스 우클릭 > 속성 > 중간쯤에 있는 컴퓨터 이름, 도메인 및 작업 그룹 설정영역의 설정 변경을 클릭 고급탭 클릭 > 환경..
-
IfEx01.java-조건문 - 단일 If문
조건문 - 단일 If문 소스코드 public class IfEx01 { public static void main(String[] args) { int n =10; // int n =4; if( n > 5){ System.out.println("n은 5보다 크다"); } System.out.println("프로그램 종료"); } } 출력결과 n=4인 경우 n=10인 경우