Short Answer/Type question with answer in Java Programming

1. What is an interface?
The interface is just like a class which contains final variables and public abstract methods.
It is used to implement multiple inheritances in java.

2. What is an abstract method?
The method which has the only declaration in the superclass and defined in the subclass
is known as an abstract method.
Syntax for defining an interface
interface interfacename
{
//define the static variables and declare abstract methods
}

3. How to implement an interface?
The abstract methods should be implemented in a class to use the interface in
our program.
class className extends superclass-name implements interface1, interface2, …
{
//define the members
}

4. What is the package?
The package is a collection of interfaces and classes.

5. How a package can be created?
A package can be created using the package statement.

6. How a package can be imported into the program?
A package can be imported using the import statement.

7. What is an applet?
The applet is a small interactive Java program that is used for web application.

8. What are the two packages that are needed to create an applet?
Java.awt and java.applet

9. What is an applet tag?
Applet tag is an HTML tag that is used to run the java applets.

10. What is an event?
The event is an interruption given to the running program using input devices such as a mouse, keyboard etc.

11. What package is needed to handle an event?
java.awt.event

12. What are the steps needed to handle the event?
1. Import java.awt.event
2. Implement the corresponding Event Listener interfaces
3. Register the Event Listeners with the event source.
4. Override the appropriate methods of the listener interfaces.
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: