How to convert a String to CharSequence?

后端 未结 5 700
别跟我提以往
别跟我提以往 2020-11-28 20:06

How to convert String to CharSequence in Java?

5条回答
  •  醉梦人生
    2020-11-28 20:07

    CharSequence is an interface and String is its one of the implementations other than StringBuilder, StringBuffer and many other.

    So, just as you use InterfaceName i = new ItsImplementation(), you can use CharSequence cs = new String("string") or simply CharSequence cs = "string";

提交回复
热议问题