Java Applets Interview Questions with Answer

Categories: Interview questions and answers Experienced Freshers Java

Java Applets Interview Questions with Answer

 

Q1. What is an Applet? 

Answer: A java applet is program that can be included in a HTML page and be executed in a java enabled client browser. Applets are used for creating dynamic and interactive web applications.

 

Q2. Explain the life cycle of an Applet. 

Answer: An applet may undergo the following states: 

  • Init: An applet is initialized each time is loaded. 
  • Start: Begin the execution of an applet. 
  • Stop: Stop the execution of an applet. 
  • Destroy: Perform a final cleanup, before unloading the applet.

 

Q3. What happens when an applet is loaded? 

AnswerFirst of all, an instance of the applet’s controlling class is created. Then, the applet initializes itself and finally, it starts running

 

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

Answer: Applets are executed within a java-enabled browser, but a Java application is a standalone Java program that can be executed outside of a browser. However, they both require the existence of a Java Virtual Machine (JVM). Furthermore, a Java application requires a main method with a specific signature, in order to start its execution. Java applets don’t need such a method to start their execution. Finally, Java applets typically use a restrictive security policy, while Java applications usually use more relaxed security policies.

 

Q5. What are the restrictions imposed on Java applets? 

AnswerMostly due to security reasons, the following restrictions are imposed on Java applets: 

  • An applet cannot load libraries or define native methods. 
  • An applet cannot ordinarily read or write files on the execution host. 
  • An applet cannot read certain system properties. 
  • An applet cannot make network connections except to the host that it came from. • An applet cannot start any program on the host that’s executing it.

 

Q6. What are untrusted applets? 

Answer: Untrusted applets are those Java applets that cannot access or execute local system files. By default, all downloaded applets are considered as untrusted.

 

Q7. What is the difference between applets loaded over the internet and applets loaded via the file system? 

AnswerRegarding the case where an applet is loaded over the internet, the applet is loaded by the applet classloader and is subject to the restrictions enforced by the applet security manager. Regarding the case where an applet is loaded from the client’s local disk, the applet is loaded by the file system loader. Applets loaded via the file system are allowed to read files, write files and to load libraries on the client. Also, applets loaded via the file system are allowed to execute processes and finally, applets loaded via the file system are not passed through the byte code verifier.

 

Q8. What is the applet class loader, and what does it provide? 

AnswerWhen an applet is loaded over the internet, the applet is loaded by the applet classloader. The class loader enforces the Java namespace hierarchy. Also, the class loader guarantees that a unique namespace exists for classes that come from the local file system, and that a unique namespace exists for each network source. When a browser loads an applet over the net, that applet’s classes are placed in a private namespace associated with the applet’s origin. Then, those classes loaded by the class loader are passed through the verifier.The verifier checks that the class file conforms to the Java language specification . Among other things, the verifier ensures that there are no stack overflows or underflows and that the parameters to all bytecode instructions are correct.

 

Q9. What is the applet security manager, and what does it provide? 

AnswerThe applet security manager is a mechanism to impose restrictions on Java applets. A browser may only have one security manager. The security manager is established at startup, and it cannot thereafter be replaced, overloaded, overridden, or extended.

Top articles
Servlet interview questions and answers for experienced Published at:- Spring Interview Questions and Answer for Experienced Published at:- Spring Boot Features for Java Developers (2022) Published at:- Detecting build version and time at runtime in Spring Boot Published at:- AWS Interview Questions Answers for Freshers and Experienced Published at:- Laravel Interview Question Answer for Freshers and Experienced Published at:- Splunk Interview Questions and Answers for freshers and Experienced Published at:- IOS Interview Questions for freshers and experienced Published at:- Red Hat Interview Question Answers for Freshers and experienced Published at:- Python Interview Question and Answer Published at:- Basic Indian History General Knowledge Question and Answer (Quiz) Published at:- AWS Interview Question and Answer for freshers and Experienced Published at:- Angular 13 interview Question and Answer Published at:- Question bank for Limited Departmental Competitive Examination (LDC) examination Published at:- Question bank for Limited Departmental Competitive Examination (LDC) examination (Set 2) Published at:- Question bank for Limited Departmental Competitive Examination (LDC) examination (Set 3) Published at:- Limited Departmental Competitive examination (LDC) examination (Water supply) Published at:- Interview Question and answer for Limited Departmental Competitive Examination Published at:- Question bank for Limited Departmental Competitive Examination (LDC) examination (Soil mechanics) Published at:- Question bank for Limited Departmental Competitive Examination (LDC) examination Sanitary Engineering Published at:- Interview Question for Limited Departmental Competitive Examination (LDC) Principles of Surveying Published at:- Interview MCQ question for railways New Lines, Doublings & Gauge Conversion Projects Published at:- MCQ Interview Question and answer for Railway Station and Passenger Amenities Published at:- Interview Question and Answer for Railway preparation Published at:- PHP MCQ Quiz Question with Answer Published at:- PHP MCQ Quiz Question with Answer (set 2) Published at:- Angular MCQ Quiz Question and Answer Published at:- Angular MCQ Quiz Question and Answer Set 2 Published at:- Java General Interview Questions and Answer Published at:- Java Threads Interview Question and Answer for experienced Published at:- Java Collections Interview Question and Answer for freshers and experienced Published at:- Garbage Collector in Java Frequently Asked Questions and Answers Published at:- Difference between Exception and Error in java Exception Handling Published at:- Java Applets Interview Questions with Answer Published at:- Java Swing Interview Questions with Answer for freshers and experienced Published at:- Java Database Connectivity (JDBC) Interview Question and answer Published at:- Remote Method Invocation (RMI) Interview Question and Answer Published at:- Jakarta Server Page (JSP) programming language Interview Question and Answer Published at:- Write a program in Java to display the first 10 terms of the following series: 10, 20, 30, 40, …….. Published at:- Write the program in Java to display the first ten terms of the following series: 1, 4, 9, 16, Published at:-
R4Rin Team
The content on R4Rin.com website is created by expert teams.