automatically when an object is created. A method, on the other hand, is a block of code that performs a specific task and needs to be called explicitly. 16. What is the Java Virtual Machine (JVM)? The JVM is a crucial part of the Java platform. It is responsible for executing Java bytecode and provides a runtime environment in which Java programs can run on any hardware or operating system. 17. What is the Java Development Kit (JDK)? The JDK is a software development kit provided by Oracle, which includes the necessary tools and libraries to develop, compile, and run Java programs. It consists of
the JVM, compiler, and other utilities. 18. What is the difference between the JDK and the JRE? The JDK (Java Development Kit) is a software development kit that includes the tools needed to develop Java applications, while the JRE (Java Runtime Environment) is a runtime environment required to run Java applications. 19. What is a package in Java? A package in Java is a way of organizing related classes and interfaces. It provides a namespace and helps in avoiding naming conflicts. 20. What is the difference between an abstract class and an interface? An abstract class can have both abstract and non-abstract methods and can be extended by other classes, while an interface only contains abstract method declarations and can be implemented by classes. 21. What is a static method in Java? A static method in Java is a method that belongs to the class rather than an instance of the class. It can be called without creating an object of the class. 22. What is the keyword "final" used for in Java? The "final" keyword in Java can be used to declare a variable, a method, or a class. A