• <tfoot id='YjBU7'></tfoot>
      <bdo id='YjBU7'></bdo><ul id='YjBU7'></ul>

    1. <small id='YjBU7'></small><noframes id='YjBU7'>

      <legend id='YjBU7'><style id='YjBU7'><dir id='YjBU7'><q id='YjBU7'></q></dir></style></legend>
      <i id='YjBU7'><tr id='YjBU7'><dt id='YjBU7'><q id='YjBU7'><span id='YjBU7'><b id='YjBU7'><form id='YjBU7'><ins id='YjBU7'></ins><ul id='YjBU7'></ul><sub id='YjBU7'></sub></form><legend id='YjBU7'></legend><bdo id='YjBU7'><pre id='YjBU7'><center id='YjBU7'></center></pre></bdo></b><th id='YjBU7'></th></span></q></dt></tr></i><div id='YjBU7'><tfoot id='YjBU7'></tfoot><dl id='YjBU7'><fieldset id='YjBU7'></fieldset></dl></div>
      1. Java 应用程序的入口点:main()、init() 还是 run()?

        Entry point for Java applications: main(), init(), or run()?(Java 应用程序的入口点:main()、init() 还是 run()?)
        <legend id='pUDUz'><style id='pUDUz'><dir id='pUDUz'><q id='pUDUz'></q></dir></style></legend>

        • <bdo id='pUDUz'></bdo><ul id='pUDUz'></ul>

                <tbody id='pUDUz'></tbody>
              <tfoot id='pUDUz'></tfoot>

              <i id='pUDUz'><tr id='pUDUz'><dt id='pUDUz'><q id='pUDUz'><span id='pUDUz'><b id='pUDUz'><form id='pUDUz'><ins id='pUDUz'></ins><ul id='pUDUz'></ul><sub id='pUDUz'></sub></form><legend id='pUDUz'></legend><bdo id='pUDUz'><pre id='pUDUz'><center id='pUDUz'></center></pre></bdo></b><th id='pUDUz'></th></span></q></dt></tr></i><div id='pUDUz'><tfoot id='pUDUz'></tfoot><dl id='pUDUz'><fieldset id='pUDUz'></fieldset></dl></div>

                  <small id='pUDUz'></small><noframes id='pUDUz'>

                • 本文介绍了Java 应用程序的入口点:main()、init() 还是 run()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  到目前为止,我一直在使用 public void run() {} 方法在 Java 中执行我的代码.何时/为什么要使用 main()init() 而不是 run()?

                  So far I've been using public void run() {} methods to execute my code in Java. When/why might one want to use main() or init() instead of run()?

                  推荐答案

                  这是一个特殊的问题,因为它不应该是一个选择问题.

                  This is a peculiar question because it's not supposed to be a matter of choice.

                  当你启动JVM时,你指定一个类来运行,它是这个类的main()你的程序开始的地方.

                  When you launch the JVM, you specify a class to run, and it is the main() of this class where your program starts.

                  通过 init(),我假设您的意思是 JApplet 方法.当在浏览器中启动小程序时,指定小程序的init()方法作为第一业务顺序执行.

                  By init(), I assume you mean the JApplet method. When an applet is launched in the browser, the init() method of the specified applet is executed as the first order of business.

                  run(),我假设你的意思是 Runnable 的方法.这是新线程启动时调用的方法.

                  By run(), I assume you mean the method of Runnable. This is the method invoked when a new thread is started.

                  • main:程序开始
                  • init:小程序启动
                  • 运行:线程启动

                  如果 Eclipse 正在运行您的 run() 方法,即使您没有 main(),那么它正在做一些特殊且非标准的事情,但并非不可行.或许您应该发布一个您一直以这种方式运行的示例类.

                  If Eclipse is running your run() method even though you have no main(), then it is doing something peculiar and non-standard, but not infeasible. Perhaps you should post a sample class that you've been running this way.

                  这篇关于Java 应用程序的入口点:main()、init() 还是 run()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的默认语言环境设置以使其保持一致?)
                  • <tfoot id='qYaCB'></tfoot>
                    • <bdo id='qYaCB'></bdo><ul id='qYaCB'></ul>

                      <small id='qYaCB'></small><noframes id='qYaCB'>

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

                            <tbody id='qYaCB'></tbody>
                            <i id='qYaCB'><tr id='qYaCB'><dt id='qYaCB'><q id='qYaCB'><span id='qYaCB'><b id='qYaCB'><form id='qYaCB'><ins id='qYaCB'></ins><ul id='qYaCB'></ul><sub id='qYaCB'></sub></form><legend id='qYaCB'></legend><bdo id='qYaCB'><pre id='qYaCB'><center id='qYaCB'></center></pre></bdo></b><th id='qYaCB'></th></span></q></dt></tr></i><div id='qYaCB'><tfoot id='qYaCB'></tfoot><dl id='qYaCB'><fieldset id='qYaCB'></fieldset></dl></div>