有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何打印字符串而不将其放入双引号中

此字符串需要在不使用双引号的情况下打印

 Class Test{
 public static void main(String args[]){

 //print "I am khushi" but it should not be printed like 
 //System.out.println("I am khushi");

 }
 }

共 (2) 个答案

  1. # 1 楼答案

    System.out.println(\u0022I am khushi\u0022);
    
  2. # 2 楼答案

    这个

    public static void main(String[] args) {
        char[] msg = new char[]{73, 32, 97, 109, 32, 107, 104, 117, 115, 104, 105};
        System.out.println(String.valueOf(msg));
    }