简体   繁体   中英

Why my computer beeps while using String(char[]ch) code?

I am using JCreator,it compiles fine but beeps while running the code

class StringDemo {

public static void main(String[]args){

    char[]arr={7};

    String s1= new String(arr);
    System.out.println(s1); //prints nothing

  }
}

Ascii/Unicode character 7 is the 'bell' code . As such, when you print it, the console is configured to generate a sound.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM