-1
이 프로그램의 출력은 다음과 같습니다두 개의 연결된 문자열의 바이트 값을 가져 오는 방법 ...?
[[email protected][[email protected]
[[email protected]
필요한 출력은 다음과 같습니다
[[email protected][[email protected]
[[email protected][[email protected]
이 도와주세요 ... 당신의 결과에
import java.util.Scanner;
import java.io.InputStreamReader;
public class testme {
public static void main(String[] args) {
Scanner in = new Scanner(new InputStreamReader(System.in));
String s = "hello";
String sb = "hi";
String sc = s.concat(sb);
byte[] a, b;
a = s.getBytes();
b = sb.getBytes();
byte[] c = new byte[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
System.out.println(a + "" + b + "\n" + c);
}
}
? 개미
출력은, Arrays.toString 방법을 인쇄 해보십시오 값이 연결됩니다 알고 여부합니다 –
전체 프로그램의 목적은 무엇입니까? – Kayaman
그건 말이 안됩니다. 세 개의 배열 (정확히 말해서 그 배열의 toString) 만 출력하면 "[B"는 네 번 출력되지 않습니다. 또한 String 표현은 결정적이지 않은 배열의 objectId에 따라 다릅니다. 배열 내용을 인쇄하고 싶습니다. toString ... –