码迷,mamicode.com
首页 > 编程语言 > 详细

java CharSequence接口

时间:2017-11-26 12:46:51      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:实现类   obj   seq   str   contain   重写   sam   har   length   

1)CharSequence接口重新定义了toString()方法,这就要求实现类必须重写object中的toString()方法

String toString()Returns a string containing the characters in this sequence in the same order as this sequence. The length of the string will be the length of this sequence. 

Overrides: 
toString in class Object 
Returns:
a string consisting of exactly this sequence of characters

我们在实现时,如果定义接口时,我们对Object类中的一些方法不满意是,可以在接口中要求子类重写。

java CharSequence接口

标签:实现类   obj   seq   str   contain   重写   sam   har   length   

原文地址:http://www.cnblogs.com/dingcx/p/7898522.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!