English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
이 메서드를 사용하여valueOf()
문자열을 바이트로 변환하는 메서드를 사용하여, 먼저, 한 줄을 보겠습니다.
String str = "65";
이제, 이 메서드를 사용하여valueOf()
문자열을 바이트로 변환하는 메서드입니다.
byte res = Byte.valueOf(str);
전체 예제를 보겠습니다.
public class Demo { public static void main(String[] args) { String str = "65"; System.out.println("String: " );+str); byte res = Byte.valueOf(str); System.out.println("Byte: " );+res); } }
출력 결과
String: 65 Byte: 65