Java Applet和C ++之间的主要区别是什么?

时间:2021-01-18 17:17:57

I can point some differences between Java language and C++ like:

我可以指出Java语言和C ++之间的一些区别,如:

  • Java uses both compiler and interpreter, C++ only compiler;
  • Java使用编译器和解释器,仅使用C ++编译器;

  • C++ compiles to machine language, when Java compiles to byte code;
  • 当Java编译为字节代码时,C ++编译为机器语言;

  • Unlikely Java, C++ has pointers (?);
  • 不像Java,C ++有指针(?);

  • In C++ the programmer needs to worry about freeing the allocated memory, where in Java the Garbage Collector takes care of the the unneeded / unused variables
  • 在C ++中,程序员需要担心释放分配的内存,在Java中,垃圾收集器负责处理不需要/未使用的变量

but how about the Applets? Which differences could I point out comparing to C++?

但Applets怎么样?与C ++相比,我可以指出哪些差异?


I'm study for a test and my professor give us a "Study Guide", where there is a question that is:

我正在学习考试,我的教授给我们一个“学习指南”,其中有一个问题是:

"State 3 ways that an Applet is significantly different from a typical C++ program."

“说明Applet与典型的C ++程序有很大不同的3种方式。”

I know the basic differences between Java/C++, I just don't know what is expected to write about Applets and C++. It seems a stranger comparison for me...

我知道Java / C ++之间的基本区别,我只是不知道对Applet和C ++的期望是什么。对我来说这似乎比较奇怪......

He also asked about the differences and similarities between both languages, this one about Applets vs C++ that seems stranger..

他还询问了两种语言之间的差异和相似之处,这篇关于Applets与C ++的看法比较陌生。

3 个解决方案

#1


0  

I would point out the following facts:

我想指出以下事实:

  • An applet is written in Java, which basically means you can execute the same code on different architectures as long as they have an implementation of the JVM.

    applet是用Java编写的,这基本上意味着只要具有JVM的实现,就可以在不同的体系结构上执行相同的代码。

  • An applet can be sandboxed, which allows the execution of untrusted code. Doing this with C++ is not supported "out of the box".

    applet可以是沙箱,允许执行不受信任的代码。 “开箱即用”不支持使用C ++执行此操作。

#2


2  

There is no such thing as C++ applets.

没有C ++ applet这样的东西。

This is because the Java Virtual Machine (JVM) execution model lets code be "sandboxed", letting the browser and/or user limit what it has access to on the executing machine. The JVM also means that the code can be executed on any processor, whereas if you downloaded a C++ executable you'd either have to compile it locally or have a separate downloadable for every possible architecture.

这是因为Java虚拟机(JVM)执行模型允许代码被“沙箱化”,允许浏览器和/或用户限制它在执行机器*问的内容。 JVM还意味着代码可以在任何处理器上执行,而如果您下载了C ++可执行文件,则必须在本地编译它,或者为每种可能的体系结构单独下载。

#3


0  

I think you're asking two different questions in one

我想你在一个问两个不同的问题

  • the differences between Java and C++, and
  • Java和C ++之间的区别

  • the differences between an applet and an application.
  • applet和应用程序之间的差异。

You've already listed some of the key differences between Java and C++ (although you missed the whole business of interfaces and multiple inheritance). The key difference between an applet and an application is that an applet runs in a container of some type - a browser in the case of a Java web applet. This means that it's in an environment that severely restricts what operations it can perform.

您已经列出了Java和C ++之间的一些主要区别(尽管您错过了接口和多重继承的全部业务)。 applet和应用程序之间的主要区别在于applet在某种类型的容器中运行 - 在Java Web applet的情况下是一个浏览器。这意味着它处于一个严重限制其可以执行的操作的环境中。

#1


0  

I would point out the following facts:

我想指出以下事实:

  • An applet is written in Java, which basically means you can execute the same code on different architectures as long as they have an implementation of the JVM.

    applet是用Java编写的,这基本上意味着只要具有JVM的实现,就可以在不同的体系结构上执行相同的代码。

  • An applet can be sandboxed, which allows the execution of untrusted code. Doing this with C++ is not supported "out of the box".

    applet可以是沙箱,允许执行不受信任的代码。 “开箱即用”不支持使用C ++执行此操作。

#2


2  

There is no such thing as C++ applets.

没有C ++ applet这样的东西。

This is because the Java Virtual Machine (JVM) execution model lets code be "sandboxed", letting the browser and/or user limit what it has access to on the executing machine. The JVM also means that the code can be executed on any processor, whereas if you downloaded a C++ executable you'd either have to compile it locally or have a separate downloadable for every possible architecture.

这是因为Java虚拟机(JVM)执行模型允许代码被“沙箱化”,允许浏览器和/或用户限制它在执行机器*问的内容。 JVM还意味着代码可以在任何处理器上执行,而如果您下载了C ++可执行文件,则必须在本地编译它,或者为每种可能的体系结构单独下载。

#3


0  

I think you're asking two different questions in one

我想你在一个问两个不同的问题

  • the differences between Java and C++, and
  • Java和C ++之间的区别

  • the differences between an applet and an application.
  • applet和应用程序之间的差异。

You've already listed some of the key differences between Java and C++ (although you missed the whole business of interfaces and multiple inheritance). The key difference between an applet and an application is that an applet runs in a container of some type - a browser in the case of a Java web applet. This means that it's in an environment that severely restricts what operations it can perform.

您已经列出了Java和C ++之间的一些主要区别(尽管您错过了接口和多重继承的全部业务)。 applet和应用程序之间的主要区别在于applet在某种类型的容器中运行 - 在Java Web applet的情况下是一个浏览器。这意味着它处于一个严重限制其可以执行的操作的环境中。