相对较新的Java编程但是“Android的工作室”混淆 [英] Relatively new to Java programming but confused with 'Android studio'

查看:89
本文介绍了相对较新的Java编程但是“Android的工作室”混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我一直在做使用Java和NetBeans IDE(我有涡轮德尔福,蟒蛇和一些C#经验)一些机器人编程,我已经读懂了GUI的阶段,for循环,switch语句,数组和使用一些库(主要来自当然我现在考虑在我高中)。

我被教导说所有的Java程序都需要一个主的方法,这是在公共静态无效的主要(字串[] args){} 。但是采用了android工作室(它使用的IntelliJ IDE)时,基地code看起来不同,并没有'main方法。

这是如何工作的?


解决方案

  

我被教导说所有的Java程序都需要一个主的方法,这是在公共静态无效的主要(字串[] args){}


这完全取决于你的节目的定义。


  

这是如何工作的?


有任意数量的开发人员可以编写Java code方式,开发商可能认为是一个计划,即不涉及开发人员编写方法:


  • Java Servlet或者其他形式的Java Web应用程序不涉及该Web应用程序的作者有写


  • 我不记得Java小程序要求方法,但它是一个很长一段时间,因为我看着那些


  • 插件用于其他基于Java的程序,就像你所运行的非常的Andr​​oid Studio中,不涉及插件作者写了


  • 一个JUnit测试套件不涉及测试套件笔者写


有责任的的东西的加载你的code和运行它。这是什么东西是,和你的计划的预期,达到的东西的作者。仅仅因为通过 的Java运行Java程序 命令恰好需要方法做不是说的所有的运行Java程序需要​​方法。

在了Android的情况下,东西是Android框架类,与其他低级别的管道在Android应用的过程音乐会。

Recently I've been doing some android programming using Java and the Netbeans IDE (I have experience with Turbo Delphi, python and some c#), I have gotten to the stage of GUI's, for loops, switch statements, arrays and using some of the libraries (mainly from the course I am taking right now at my high school).

I have been taught that ALL java programs need a 'main' method and this is under public static void main( String[ ] args ) {}. However when using android studio (which uses the IntelliJ IDE), the base code looks different and has no 'main method'.

How does this work?

解决方案

I have been taught that ALL java programs need a 'main' method and this is under public static void main( String[ ] args ) {}.

That depends entirely upon your definition of "program".

How does this work?

There are any number of ways that a developer can write Java code, that the developer might consider to be a "program", that does not involve the developer writing a main method:

  • A Java servlet or other forms of a Java Web app do not involve a main method that the author of the Web app has to write

  • I don't recall Java applets requiring a main method, but it's been a long while since I looked at those

  • Plugins for other Java-based programs, like the very Android Studio that you are running, do not involve the plugin author writing a main method

  • A JUnit test suite does not involve the test suite author writing a main method

It is the responsibility of something to load your code and run it. What that "something" is, and its expectations of your program, is up to the authors of the "something". Just because running a Java program via the java command happens to require a main method does not mean that everything running a Java program requires a main method.

In the case of Android, the "something" is the Android framework classes, in concert with other low-level plumbing in your Android app's process.

这篇关于相对较新的Java编程但是“Android的工作室”混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆