“进口”Java中与在C / C'的#include“++ [英] 'import' in Java vs. '#include' in C/C++

查看:142
本文介绍了“进口”Java中与在C / C'的#include“++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是'进口'在Java中的行为以同样的方式在C / C'的#include++?具体来说,包括它是进口或将只是包括被称为在随后的code中的类和方法的整个库?

Does 'import' in Java behave in the same way as '#include' in C/C++? Specifically, will it include the entire library that it is importing or will it just include the classes and methods that are called in the subsequent code?

推荐答案

的#include 确实没有这两个,既不是进口的库,也不是类或模块。

#include does none of both, neither "importing" libraries, nor classes or modules.

的#include 指令只是告诉了pre处理器包括另一个文本文件(源)的内容。这就是全部。

The #include directive just tells the pre-processor to include the contents of another text file (source). That's all.

pre-处理文件中的的#include ING文件B被传递到编译器就好像它们是一个文件,具有文件B的结果粘贴到文件一个在其中的#include 指令被放置的位置。

The result of pre-processing file A #includeing file B is passed to the compiler as if they were one file, with file B pasted into file A at the position where the #include directive was placed.

要expliclity状态是:这一切发生的之前以任何编译,code代

To expliclity state this: This all happens prior to any compilation, code generation.

作为一个副作用的C / C ++ pre-处理器可以独立于编译器用于处理的任何类型的文本文件输入的。

As a side effect the C/C++ pre-processor could be used independently from the compiler to process any kind of text file input.

有人可能会说pre处理器之类的语句的#include 是C / C ++语言中没有真正的一部分,因为它们没有本质上需要用C / C ++的程序,因为他们永远不会传递到编译器。

One could argue that pre-processor statements like #include "are not really part of the C/C++ languages", as they are not essentially needed to write any programs in C/C++, as they are never passed to the compiler.

这位前pression 导入不在(标准)C / C ++编程的情况下使用,因为其中没有进口。

The expression import is not used in the context of (standard) C/C++ programming, as there is nothing to be imported.

C / C ++模块放在一起无论是在源代码级的之前以编译或链接器的编辑。

C/C++ modules are put together either on source level prior to compilation or by the linker after compilation.

这篇关于“进口”Java中与在C / C'的#include“++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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