Can I add new methods to the String class in Java?

后端 未结 15 2227
再見小時候
再見小時候 2020-11-27 06:36

I\'d like to add a method AddDefaultNamespace() to the String class in Java so that I can type \"myString\".AddDefaultNamespace() instead of

15条回答
  •  自闭症患者
    2020-11-27 07:12

    String is a final class which means it cannot be extended to work on your own implementation.

提交回复
热议问题