<legend id='0ecaF'><style id='0ecaF'><dir id='0ecaF'><q id='0ecaF'></q></dir></style></legend>

    • <bdo id='0ecaF'></bdo><ul id='0ecaF'></ul>

    <i id='0ecaF'><tr id='0ecaF'><dt id='0ecaF'><q id='0ecaF'><span id='0ecaF'><b id='0ecaF'><form id='0ecaF'><ins id='0ecaF'></ins><ul id='0ecaF'></ul><sub id='0ecaF'></sub></form><legend id='0ecaF'></legend><bdo id='0ecaF'><pre id='0ecaF'><center id='0ecaF'></center></pre></bdo></b><th id='0ecaF'></th></span></q></dt></tr></i><div id='0ecaF'><tfoot id='0ecaF'></tfoot><dl id='0ecaF'><fieldset id='0ecaF'></fieldset></dl></div>
  1. <small id='0ecaF'></small><noframes id='0ecaF'>

      <tfoot id='0ecaF'></tfoot>
    1. 最终类中的非最终方法

      Non-final methods in a final class(最终类中的非最终方法)
      • <i id='7I050'><tr id='7I050'><dt id='7I050'><q id='7I050'><span id='7I050'><b id='7I050'><form id='7I050'><ins id='7I050'></ins><ul id='7I050'></ul><sub id='7I050'></sub></form><legend id='7I050'></legend><bdo id='7I050'><pre id='7I050'><center id='7I050'></center></pre></bdo></b><th id='7I050'></th></span></q></dt></tr></i><div id='7I050'><tfoot id='7I050'></tfoot><dl id='7I050'><fieldset id='7I050'></fieldset></dl></div>
        <tfoot id='7I050'></tfoot>

          1. <legend id='7I050'><style id='7I050'><dir id='7I050'><q id='7I050'></q></dir></style></legend>

            <small id='7I050'></small><noframes id='7I050'>

                <tbody id='7I050'></tbody>
                <bdo id='7I050'></bdo><ul id='7I050'></ul>
                本文介绍了最终类中的非最终方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我的问题很简单:
                编译器是否将最终类中的所有方法都视为最终方法?给final类的方法加上final关键字有什么作用吗?

                My question is pretty simple:
                Does the compiler treat all the methods in a final class as being final themselves? Does adding the final keyword to methods in a final class has any effect?

                我知道 final 方法有更好的内联机会,这就是我问的原因.

                I understood that final methods have a better chance of getting inlined and this is why I am asking.

                提前致谢.

                推荐答案

                你说得对,final类中的所有方法都是隐式final的.

                You're correct, all methods in a final class are implicitly final.

                见这里:

                "请注意,您还可以声明整个类 final.声明的 final 不能被子类化.这特别有用,因为例如,在创建像 String 类这样的不可变类时."

                "Note that you can also declare an entire class final. A class that is declared final cannot be subclassed. This is particularly useful, for example, when creating an immutable class like the String class."

                这里:

                final 类中的所有方法都是隐式 final.

                All methods in a final class are implicitly final.

                您可能也会感兴趣:Java final 关键字的性能提示

                这篇关于最终类中的非最终方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                <i id='D3D6a'><tr id='D3D6a'><dt id='D3D6a'><q id='D3D6a'><span id='D3D6a'><b id='D3D6a'><form id='D3D6a'><ins id='D3D6a'></ins><ul id='D3D6a'></ul><sub id='D3D6a'></sub></form><legend id='D3D6a'></legend><bdo id='D3D6a'><pre id='D3D6a'><center id='D3D6a'></center></pre></bdo></b><th id='D3D6a'></th></span></q></dt></tr></i><div id='D3D6a'><tfoot id='D3D6a'></tfoot><dl id='D3D6a'><fieldset id='D3D6a'></fieldset></dl></div>
                    <tbody id='D3D6a'></tbody>
                • <small id='D3D6a'></small><noframes id='D3D6a'>

                    <legend id='D3D6a'><style id='D3D6a'><dir id='D3D6a'><q id='D3D6a'></q></dir></style></legend>

                      <bdo id='D3D6a'></bdo><ul id='D3D6a'></ul>
                        1. <tfoot id='D3D6a'></tfoot>