ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 문자열관련2
    JAVA 2023. 5. 18. 23:34

    자바배열

    자료형[] 변수 = new 자료형[배열 크기];

    int[] score = {1, 2, 3, 4, 5};
    for (int i : score){}
    for (int i; i< score.length; i++){}

    숫자 -> 문자로 / 문자 -> 숫자로

    int a = 1;
    Integer.toString(a) //"1"
    String b = "1";
    Integer.parseInt(b)//1
    Integer.valueof(b)
    
    int a = 1;
    int b = 2;
    
    String x = "" + a + b //문자열 + 숫자 => 숫자를 문자열로 처리
    String y = "" + b + a
    answer = x > y ? x : y; //x가 y보다 크면 answer 은 x

    'JAVA' 카테고리의 다른 글

    자바 비교  (0) 2023.05.22
    문자열 관련  (0) 2023.05.17
Designed by Tistory.