String s = "loveyou";
char[] c = {'l','o','v','e','y','o','u'};
String str = new String( c );
if( s.equals( str ) )
  //相等
else
  //不相等

解决方案 »

  1.   

    String s = "loveyou";
    char[] c = {'l','o','v','e','y','o','u'};
       if(s.equals(String.valueOf(c))){
       System.out.println("yes");   }else{
         System.out.println("no");
       }
      

  2.   

    直接的方法是什么意思JAVA中存在不属于任何类的函数吗?!
      

  3.   

    char[] c={'a','b','c','d'};
    String s="abcd";String s1=new String(c);判断:  if( s.equals(s1)) {......}