0% found this document useful (0 votes)
6 views3 pages

Java Interview Questions for Freshers

The document provides a comprehensive list of Java interview questions tailored for freshers, covering core concepts, object-oriented programming principles, basic coding tasks, and miscellaneous topics. Key areas include definitions and differences between Java components (JDK, JRE, JVM), OOP concepts (inheritance, polymorphism, encapsulation, abstraction), and fundamental coding examples. It also addresses method overloading, overriding, the use of the 'final' keyword, garbage collection, arrays, and access modifiers.

Uploaded by

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

Java Interview Questions for Freshers

The document provides a comprehensive list of Java interview questions tailored for freshers, covering core concepts, object-oriented programming principles, basic coding tasks, and miscellaneous topics. Key areas include definitions and differences between Java components (JDK, JRE, JVM), OOP concepts (inheritance, polymorphism, encapsulation, abstraction), and fundamental coding examples. It also addresses method overloading, overriding, the use of the 'final' keyword, garbage collection, arrays, and access modifiers.

Uploaded by

Satya Bobby
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Interview Questions for Freshers

Core Java Interview Questions for Freshers

1. What is Java?

- Java is a high-level, object-oriented programming language developed by Sun Microsystems, now owned by Oracle.

2. What are the features of Java?

- Platform Independent, Object-Oriented, Simple and Secure, Robust and Portable, Multithreaded, High Performance

3. Difference between JDK, JRE, and JVM?

- JDK: Java Development Kit (JRE + Development Tools)

- JRE: Java Runtime Environment (JVM + libraries)

- JVM: Java Virtual Machine (executes bytecode)

4. Data Types in Java?

- Primitive: int, float, double, boolean, char, byte, short, long

- Non-Primitive: String, Arrays, Classes, Interfaces

5. Difference between '==' and '.equals()'?

- '==': Compares memory addresses

- '.equals()': Compares values/content

Object-Oriented Programming (OOPs) Concepts

6. What is a constructor?

- A special method to initialize objects.

7. What is inheritance?

- Enables a class to inherit features from another class.

8. What is polymorphism?
Java Interview Questions for Freshers

- Ability of a method to perform different tasks.

- Compile-time (Overloading), Runtime (Overriding)

9. What is encapsulation?

- Wrapping data and methods into a single unit.

10. What is abstraction?

- Hiding internal details and showing functionality.

Basic Java Coding Questions

11. Check even or odd:

int num = 10;

if(num % 2 == 0) [Link]("Even");

else [Link]("Odd");

12. Reverse a string:

String str = "hello";

String rev = "";

for(int i = [Link]() - 1; i >= 0; i--)

rev += [Link](i);

[Link](rev);

13. Factorial of a number:

int n = 5, fact = 1;

for(int i = 1; i <= n; i++) fact *= i;

[Link]("Factorial: " + fact);

Java Fundamentals
Java Interview Questions for Freshers

14. What is method overloading?

- Same method name, different parameters.

15. What is method overriding?

- Same method name and parameters in a subclass.

16. Abstract Class vs Interface:

| Feature | Abstract Class | Interface |

|--------------------|----------------------|-------------------------|

| Methods | Can have both types | Abstract/default/static |

| Multiple Inheritance | No | Yes |

| Constructor | Can have | Cannot have |

Miscellaneous Questions

17. Use of 'final' keyword?

- Prevents modification. Used with variables, methods, classes.

18. What is garbage collection?

- Automatic memory management by JVM.

19. What is an array?

- Container object that holds elements of same type.

20. Access Modifiers?

- public, private, protected, default (package-private)

You might also like