Câu hỏi phỏng vấn Java
Câu hỏi

What is the difference between an Applet and a Java Application?

Câu trả lời

The difference between a Java Applet and a Java Application primarily lies in their execution environments, usage, and access levels.

Execution and Initialization

  • Java Application: It is a standalone program that runs directly on the operating system with the support of a Java Virtual Machine (JVM). The execution of a Java application always begins with the main() method[1][2].
  • Java Applet: Unlike Java applications, applets do not start with a main() method. Instead, they are initialized through an init() method because they are designed to be embedded within a web page and run in a web browser[1][2].

Deployment and Usage

  • Java Application: These are general-purpose programs that can perform a variety of tasks independently of a web browser. They are typically distributed as executable files or JAR files and run on the client or server side[1][2][3].
  • Java Applet: Applets are small programs embedded in HTML pages and are executed within the client's browser. They are used to provide interactive features to web pages but require a Java-enabled browser to run[1][2][3].

Access and Security

  • Java Application: Applications have full access to the system resources like file systems and networks. They can interact directly with the OS and perform a wide range of operations[2][4].
  • Java Applet: Applets run in a restricted environment (sandbox) and have limited access to resources. They cannot access local file systems or networks directly and are confined to the browser's security settings[2][3][4].

User Interface

  • Java Application: Can either have a graphical user interface (GUI) or be command-line bas...
entry

entry

Gợi ý câu hỏi phỏng vấn

junior

What does System.gc() and Runtime.gc() methods do?

middle

If an object reference is set to null , will the Garbage Collector immediately free the memory held by that object?

expert

What's the difference between SoftReference and WeakReference in Java?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào