시작 전

시작 전

제어문 - 배열과 반복문

배열 String[] users = new String[3]; //크기 3개로 지정 users[0] = "A"; users[1] = "B"; users[2] = "c"; System.out.println(users[1]); //B System.out.println(users.length); //3 int[] scores = {10, 55, 100}; System.out.println(scores[1]); //55 배열과 반복문 String[] users = new String[3]; users[0] = "A"; users[1] = "B"; users[2] = "c"; for(int i=0; i

시작 전

반복문 - while 과 for

같은 반복문을 while 과 for 로 각각 작성 int i = 0; //반복문에서 횟수 카운트 변수 i while(i < 3) { System.out.println(2); System.out.println(3); i++; } // 2 // 3 // 2 // 3 // 2 // 3 for(int i=0; i

시작 전

제어문 - 연산자

public class AuthApp2 { public static void main(String[] args) { System.out.println(args[0]); String id = "ujin"; String inputId = args[0]; // 1번째 입력값 ujin String pass = "3153"; String inputPass = args[1]; // 2번째 입력값 3150 System.out.println("Hi."); if(inputId.equals(id) && inputPass.equals(pass) ) { // equals System.out.println("Master!"); } else { System.out.println("Who are u?"); } } } //ujin ..

시작 전

제어문 - 조건문

public class AuthApp { public static void main(String[] args) { System.out.println(args[0]); String id = "ujin"; String inputId = args[0]; System.out.println("Hi."); if(inputId.equals(id)) { System.out.println("Master!"); } else { System.out.println("Who are u?"); } } } // arguments에 ujin 입력 // ujin // Hi. // Master! 조건문 , 입력값은 run configuration 에서 arguments

시작 전

App 만들기 - 기본기능

public class AccountingApp { public static void main(String[] args) { System.out.println("Value of supply : "+12345.0); System.out.println("VAT : "+12345.0*0.1); System.out.println("Total : "+(12345.0+12345.0*0.1)); System.out.println("Expense : "+ (12345.0*0.3)); System.out.println("Income : "+ (12345.0-12345.0*0.3)); System.out.println("Dividend : "+ (12345.0-12345.0*0.3)* 0.5 ); System.out.pr..

시작 전

arguments & parameter

parameter 매개변수 // parameter 매개변수 public static void main(String[] args) { string id = args[0]; string bright = args[1]; } 실행 화살표 - Run Configurations 에서 argument(인자) 를 설정하게 되면, args 라는 parameter(매개변수)를 통하여 그 값을 활용 가능 argument(인자) 큰 따옴표로 묶어서 작성 예) "Seoul ART 401" "45.0" -> [0] , [1] 번째

시작 전

변수 및 데이터 타입의 변환(casting)

변수 int a = 3 //정수 double b = 2.8 //실수 string c = "Hello" //문자 casting int e = (int) 1.1; System.out.println(e); // 실수 1.1이 정수 1로 출력 string f = Integer.ToString(1); // 숫자 1이 문자열 인식

시작 전

문자열의 표현 및 다루기

public class StringApp { public static void main(string[] args) { System.out.println("Hello \nWorld"); //new line 줄 바꿈 System.out.println("Hello \"World\""); // escape 출력 Hello "World" } } \n 줄 바꿈 new line \ escape public class StringOperation { public static void main(String[] args) { System.out.println("Hello World".length()); //11 System.out.println("Hello, LISA ... bye.".replace("LISA","JAIN..

꿈꾸는야오옹
'시작 전' 카테고리의 글 목록