发生什么意见后,java文件在Android的编制? [英] What happens to comments after the java files are compiled in Android?

查看:96
本文介绍了发生什么意见后,java文件在Android的编制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Android编译器的工作?是否删除的Java code和Android的XML文件的意见汇编?

How does the Android compiler work? Does it remove the comments in Java code and Android XML files on compilation?

推荐答案

在Java文件的评论将被删除,或者被忽略,当它们被编译成class文件。类文件不是人类读 - 它们被优化为在虚拟机上有效地运行。如果意见是留,他们只会导致类文件比所需的大,并没有额外的好处(例如,编译器和虚拟机不明白的意见,那么为什么它们包括)

Comments in Java files are removed, or ignored, when they are compiled into class files. Class files are not for human-reading - they are optimized to run efficiently on a virtual machine. If the comments were to remain, they would just cause the class files to be larger than required, and for no additional benefit (ie, the compiler and virtual machines don't understand comments, so why include them)

至于XML文件,评价通常保留。而一个编译的类文件只有1目的(到虚拟机上运行),XML文件可以有多种用途。例如,您可以加载XML文件到您的应用程序,并对其进行操作。根据不同的使用你的应用程序的XML文件,它可能需要保持的评论在那里 - 事实上,你的应​​用程序可能会特意去找征求意见。因为XML文件可具有广泛的用途,所述注释不会从在情况下,它们都需要用于其它目的的XML文件中删除。

As for XML files, the comments are usually retained. Whereas a compiled class file only has 1 purpose (to run on a virtual machine), an XML file could serve many purposes. For example, you can load an XML file into your application and manipulate it. Depending on the use of the XML file in your application, it might be required to keep the comments in there - in fact, your application might specifically look for comments. Because XML files could have a wide range of uses, the comments aren't removed from XML files in case they are required for some other purpose.

这篇关于发生什么意见后,java文件在Android的编制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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