stringTest.subSequence(0,6).toString();subSequence() returns CharSequence, while displayText returns String. So you need toString().import lang is not needed. lang package will be automatically imported.

解决方案 »

  1.   

    Thank you so much,wobeisk.
    In fact,you have answered my two questions.
    But I don't know what type of the variables is this "CharSequence" in the follow sentence:
    public CharSequence subSequence(int start,int end)Can you give me an example?
      

  2.   

    CharSequence is an interface which d. String implements this interface.public interface CharSequence{
      char charAt(int index); 
      int length();
      CharSequence subSequence(int start, int end);
      String toString();
    }
      

  3.   

    in my code
    Surpose
    I don't  use "String" this variable in Here:
    public "String" displayText() //实现在接口中说明的方法displayText()
    {
    return stringTest.subSequence(0,6);
    }what should I do to make it correct?
      

  4.   

    CharSequence, of couseBTW, String or CharSequence is not variable. They are types, class type and interface type.
      

  5.   

    Thanks wobelisk.I got it
      

  6.   

    no credits to me. why?????