A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

错误代码:

  1. class StringSort3 {

  2. /**
  3. * @param args
  4. */
  5.         static String string="abc";
  6.         public static void main(String[] args) {
  7.                         // TODO Auto-generated method stub
  8.                         show(1,new String());
  9.         }
  10.         public static void show(int len, String temp) {
  11.                         // TODO Auto-generated method stub
  12.                         if(len<string.length()){
  13.                                         for(int i=0;i<string.length();i++){
  14.                                                         if(!temp.contains(string.substring(i,i+1))){
  15.                                                         System.out.print(temp+string.substring(i,i+1)+" ");
  16.                                                         show(len+1, new String(temp+string.substring(i, i+1)));
  17.                                                         }
  18.                                         }
  19.                         }
  20.                        
  21.         }

  22. }
复制代码

错误提示:The method contains(CharSequence) from the type String refers to the missing type
         CharSequence
        - The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from
         required .class files

有人知道原因吗?

3 个回复

倒序浏览
wuyusi 来自手机 中级黑马 2015-6-1 12:59:03
沙发
你使用操作字符串数组的方法在操作字符串,将“abc”改成字符串数组再试一次
回复 使用道具 举报
wuyusi 发表于 2015-6-1 12:59
你使用操作字符串数组的方法在操作字符串,将“abc”改成字符串数组再试一次 ...

这个问题只有在eclipse里出现,而在editplus里用dos运行正常
回复 使用道具 举报
wuyusi 来自手机 中级黑马 2015-6-1 13:18:17
板凳
我找个时间试下,还要多多努力
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马