一个是字符,一个是字符串char a = 'a';
String s = "sdf";

解决方案 »

  1.   

    如何把char型的变量变为string型的变量。
      

  2.   

    char
    • Represents a 16- bit Unicode character
    • Must have its literal enclosed in single quotes (’ ’)
    • Uses the following notations:
    'a ' The letter a
    ' \t' A tab
    ' \u???? ' A specific Unicode character, ???? ,
    is replaced with exactly four
    hexadecimal digits (for example,
    ’\ u03A6’ is the Greek letter phi [ F] )String
    • Is not a primitive data type; it is a class
    • Has its literal enclosed in double quotes ( " " )
    "The quick brown fox jumps over the lazy dog."
    • Can be used as follows:
    String greeting = " Good Morning !! \n ";
    String errorMessage = " Record Not Found ! ";
      

  3.   

    如何把char型的变量变为string型的变量。 char a = 'a';
    String s = ""; 
    s = s+ a;
      

  4.   

    都错了
    char a = "s";
    String s = String.valueOf(s);