What are the platforms that support Java programming language?
Java runs on several platforms. Some of these are Windows, macOS and
popular instances of Linux/UNIX. The choice of a running environment
may depend on the programming task.
Is Java architectural-neutral?
Java is platform independent. Different processors in various systems
can run Java applications. This feature makes the Java system
executable in any environment.
What is an object in Java?
In object-oriented programming technique, we design a program using
objects and classes. An object in Java is a standard Java component that
has a state and behavior.
What's the definition of “class” in Java?
A class is a blueprint for creating similar objects in Java. It is a set of
objects which share common characteristics/ behavior and common
properties/ attributes.
A class is a template for objects, and an object is an instance of a class.
Class objects
Vehicle Car
Bicycle
Bike
What is an exception in Java?
In Java, exception is an event that occurs during the execution of a
program and disrupts the normal flow of the program's instructions.
Bugs or errors that we don't want and that restrict our program's
normal execution of code are referred to as exceptions.
Can you explain encapsulation?
Encapsulation is the practice of wrapping variables and coding logic in
certain methods. When encapsulating in Java, the fields in a class
become private, providing access only through methods. This process
effectively hides data fields from anything outside the class."
What are the features of an interface?
In Java, an interface is an abstract type that specifies the behavior of a
class. Features of an interface include the absence of constructors. All
methods within it are blueprints of the class behavior.
Why would you use a “package” in Java?
Java constructed packages by gathering sub-packages, classes and
interfaces. Programmers can use a package to make searching easier,
prevent naming conflicts and provide controlled access to similar
behavior. Packages offer a form of encapsulation.
Can you define JAR file and WAR file?
JAR and WAR are archive files. JAR stands for Java Archive File, and
WAR stands for Web Archive File. JAR files aggregate Java classes and
metadata that programs require to execute Java applications, while
WAR contains web application files, such as HTML and JavaScript.“
What is a final class?
The final keyword in java finalizes the implementation of classes and
other variables. This finalization means the variables are unalterable. In
a final class, a method the class implements is constant, meaning it
ensures the behavior and implementation of the class are immutable."