Answer 1:
Access modifiers are used in Java to control the visibility of classes, methods, and variables.
They support encapsulation and improve security by restricting access where necessary.
Static members belong to the class rather than individual objects, meaning all instances
share the same copy. This feature is useful when a common value or method is required
throughout the application.
Answer 3:
Ambiguity in method overloading occurs when the compiler cannot determine which
overloaded method should be called. This situation may arise because of type conversion,
autoboxing, or null values. Since the compiler finds more than one suitable method, it
generates an error. Such ambiguity can be avoided through explicit casting or by designing
clearer method signatures.
Answer 4:
Java supports multiple inheritance through interfaces instead of classes. A single class can
implement multiple interfaces and inherit behaviors from each of them. Packages help
organize related classes into logical groups, making programs easier to manage and
maintain. They also improve code reusability and readability.
Answer 6:
JDBC is a technology that enables Java applications to communicate with databases. Using
JDBC, developers can establish database connections, execute SQL queries, and process
results. Components such as Connection, PreparedStatement, and ResultSet play important
roles in database operations. JDBC is widely used in enterprise applications for managing
data efficiently.
Answer 8:
The Abstract Window Toolkit (AWT) provides classes for building graphical user interfaces
in Java. Layout managers control how components are arranged within containers, while
event listeners respond to user actions such as button clicks. Together, these features allow
developers to create interactive desktop applications with user-friendly interfaces.