반응형
  • Integer.toString();
  • String.valueOf();

[예제]

import java.lang.String;

public static void main(String[] args) {
		int a = 10;
		
		String str1 = Integer.toString(a);
		System.out.println("int to toString : "  + str1);
		
		String str2 = String.valueOf(a);
		System.out.println("int to valueOf : "  + str2);
}

[결과]

int to toString : 10

int to valueOf : 10

728x90

+ Recent posts