Java_Exam_Answer_Sheet
Java_Exam_Answer_Sheet
1. Heap memory
3. C) public
4. True
6. True
7. A) int number[]
8. B) Independent
9. setColor()
11. True
Example:
class Library {
polymorphism.
Differences:
3. The static keyword makes a variable or method belong to the class rather than any instance of
the class.
Example:
class Example {
4. Dynamic method dispatch allows a method to be called based on the runtime type of the object.
Example:
class Parent {
}
public class Main {
5. AWT (Abstract Window Toolkit) is a Java framework for building GUI applications.
Event Listener is an interface that handles events, such as button clicks or mouse movements, in
GUI applications.
iii) Encapsulation
iii) Encapsulation
4. Create a package and write a Java file with four methods for four basic arithmetic operations.
ArithmeticOperations.java:
package operations;
Main.java:
import operations.ArithmeticOperations;
Example:
super(message);
} catch (MyException e) {
System.out.println(e.getMessage());