下面程序的结果为?
public class String_to_char {
public static void main(String[] args) {
String s = "hello";
char ch[] = s.toCharArray();
String s1 = new String(ch);
System.out.println("\n"+s1);
if(s1.equals(s)){
System.out.print(true);
}else
System.out.print(false);
if(s.equals(ch)){
System.out.print("true");
}else{
System.out.print("false");
}
char a1[] ={'h','e','l','l','o'};
if(ch.equals(a1)){
System.out.print("true");
}else{
System.out.print("false");
}
}
}
char 和String的转换问题?
最新推荐文章于 2022-10-01 20:15:38 发布