package cn.itcast_03;import java.util.Arrays;/* * 計算機是如何識別把兩個字節轉換為一個中文呢? * 在計算機中中文的存儲分兩個字節: * 第一個字節肯定是負數。 * 第二個字節常見的是負數,可能有正數。但是沒影響 */public class StringDemo { public static void main(String[] args) { // String s = "abcd"; String s = "我愛你中國"; // [-50, -46, -80, -82, -60, -29, -42, -48, -71, -6] byte[] bys = s.getBytes(); System.out.PRintln(Arrays.toString(bys)); }}
新聞熱點
疑難解答