KEMBAR78
Java Basis 25 Question | PDF | Method (Computer Programming) | Class (Computer Programming)
0% found this document useful (0 votes)
4 views3 pages

Java Basis 25 Question

Java is a high-level, object-oriented programming language that runs on the Java Virtual Machine (JVM), ensuring platform independence. Key components include the Java Development Kit (JDK) for development and the Java Runtime Environment (JRE) for running applications. Java features include object-oriented principles, encapsulation, inheritance, polymorphism, and exception handling.

Uploaded by

rajmayank1121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Java Basis 25 Question

Java is a high-level, object-oriented programming language that runs on the Java Virtual Machine (JVM), ensuring platform independence. Key components include the Java Development Kit (JDK) for development and the Java Runtime Environment (JRE) for running applications. Java features include object-oriented principles, encapsulation, inheritance, polymorphism, and exception handling.

Uploaded by

rajmayank1121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. What is Java?

Answer: Java is a high-level, class-based, object-oriented programming language


that is platform-independent due to the Java Virtual Machine (JVM).

2. What is the JVM?

Answer: JVM stands for Java Virtual Machine. It runs Java bytecode and enables
Java’s platform independence.

3. What is the JDK?

Answer: JDK (Java Development Kit) is a software development environment used to


develop Java applications. It includes the JRE and development tools like javac.

4. What is the JRE?

Answer: JRE (Java Runtime Environment) provides libraries and JVM to run Java
applications. It does not contain development tools.

5. What are the main features of Java?

Answer:

Object-Oriented

Platform Independent

Secure

Robust

Multithreaded

Portable

6. What is the main method in Java?

Answer: It's the entry point of any Java program:

public static void main(String[] args) {


// Code
}

7. What are data types in Java?

Answer: Java has two types:

Primitive (int, float, double, char, boolean, etc.)

Non-Primitive (String, Arrays, Classes, etc.)

8. What is a class in Java?

Answer: A class is a blueprint for objects. It defines properties (fields) and


behaviors (methods).

9. What is an object in Java?


Answer: An object is an instance of a class that contains state and behavior.

10. What is inheritance?

Answer: Inheritance allows a class to acquire properties and methods of another


class using the extends keyword.

11. What is encapsulation?

Answer: Encapsulation is wrapping data and code into a single unit. It uses access
modifiers like private with getters/setters.

12. What is polymorphism?

Answer: Polymorphism means many forms. It allows methods to perform different tasks
based on the object that invokes them.

13. What is abstraction?

Answer: Abstraction hides implementation details and shows only functionality. It’s
achieved using abstract classes or interfaces.

14. What is an interface?

Answer: An interface is a reference type in Java, similar to a class, that can


contain abstract methods and constants.

15. What is the difference between == and .equals()?

Answer: == compares object references, .equals() compares object content


(overridden in classes like String).

16. What are constructors in Java?

Answer: Constructors are special methods used to initialize objects. They have the
same name as the class and no return type.

17. What is method overloading?

Answer: Defining multiple methods with the same name but different parameters in
the same class.

18. What is method overriding?

Answer: A subclass provides a specific implementation of a method already defined


in its superclass.

19. What is the final keyword in Java?

Answer: It is used to declare constants, prevent method overriding, or prevent


inheritance of classes.

20. What are static methods?

Answer: Static methods belong to the class rather than an instance. They are called
using the class name.

21. What is the difference between Array and ArrayList?


Answer:

Array: Fixed size, can hold primitives and objects.

ArrayList: Resizable, only holds objects, part of the java.util package.

22. What is exception handling in Java?

Answer: Mechanism to handle runtime errors using try, catch, finally, and
throw/throws.

23. What is the difference between checked and unchecked exceptions?

Answer:

Checked: Must be handled (e.g., IOException).

Unchecked: Runtime exceptions (e.g., NullPointerException).

24. What is multithreading in Java?

Answer: Multithreading is the process of executing multiple threads simultaneously


for better CPU utilization.

25. What are access modifiers in Java?

Answer:

private – Accessible within the class only

default – Accessible within the same package

protected – Accessible in same package and subclasses

public – Accessible from everywhere

You might also like