覆盖Java字符串方法 [英] Override java string methods
本文介绍了覆盖Java字符串方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以通过扩展String类来覆盖类中String类的所有方法吗?
Can we override all the methods of String class in our class by extending String class?
推荐答案
final
类,您不能extend
它
您可能还想知道为什么它是 final
以及为什么不能扩展它,核心原因是它的不变性
You also might be interested to know why it is final
and why you can't extend it, The core reason is its immutability
请参见
这篇关于覆盖Java字符串方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文