A1: Applet is a type of Java program that runs on web browser. It can be a fully functional Java application because it has full Java API as its disposal. It is used to generate dynamic content. Works on client side, it will run inside a browser.
They are used for webpage enhancement, adding small interactive components, can also be used to display large programs like of games or word processors. Java’s portability makes it unique for WWW.
Q2) Explain the various methods of the applet life cycle by describing suitable methods to the same.
A2: There are four stages in applets life cycle:
Initialized
Started
Stop
Destroy
These stages refer to init(), start(),stop() and destroy(), …show more content…
Even if you handle them using try-catch blocks, your application will not recover if they happen. Exceptions can be handled using try-catch blocks and can make flow normal in program.
3) Exceptions in java are divided into two categories – checked and unchecked.Where as all Errors belongs to only one category i.e. unchecked.
4) Compiler will not have any knowledge about unchecked exceptions which include Errors and sub classes of Run Time Exception because they happen at run time. Where as compiler will have knowledge about checked Exceptions. Compiler will force you to keep try-catch blocks if it sees any statements which may throw checked exceptions.
5) Exceptions are related to application where as Errors are related to environment in which application is running.
Q5) Explain what are constructors and describe the use of the same with suitable examples.
A5: Constructors are used to initialize objects in java, at the time of object creation it is invoked. It provides data for an object that is why it is called a constructor. Constructor is automatically called immediately after the object is created, before the new operator completes. Constructors look a little strange because it has no return type, not even valid.
Taking an example:
Class Box { double width;
double