1.What is Java?
Java is a high-level, object-oriented programming language developed by Sun Microsystems (now owned by Oracle Corporation). It was designed to be platform-Independent and can run on any device that has a Java Virtual Machine (JVM) installed.
2. What are the features of Java?
Some of the features of Java include object-oriented programming, platform independence, automatic memory management, robustness, and security.
3. What is a class in Java?
A class in Java is a blueprint for creating objects. It defines the variables and methods that an object of that class will have.
4. What is an object in Java?
An object in Java is an instance of a class. It represents a real-world entity and has properties (variables) and behaviors (methods).
5. What is inheritance in Java?
Inheritance is a mechanism in Java that allows a new class to be based on an existing class. The new class (subclass) inherits the properties and methods of the existing class (superclass) and can also add its own unique properties and methods.
6. What is polymorphism in Java?
Polymorphism is the ability of an object to take on many forms. In Gava, this is achieved through method overloading and method overriding.
7. What is an interface in Java?
An interface in Java is a collection of abstract methods that can be implemented by a class. It defines a set of methods that a class must implement, but it does not provide any implementation itself.
8. What is a package in Java?
A package in Java is a collection of related classes and interfaces. It provides a way to organize code and prevent naming conflicts.
9. What is a constructor in Java?
A constructor in Java is a special method that is called when an object of a class is created. It is used to initialize the object’s state.
10. What is a static method in Java?
A static method in Java is a method that belongs to a class rather than to an instance of the class. It can be called without creating an object of the class