0% found this document useful (0 votes)
28 views2 pages

Java Technical Interview Cheat Sheet

This document is a Java Technical Interview Cheat Sheet covering key concepts such as the definition of Java, differences between JDK, JRE, and JVM, and features of Java. It also explains important topics like class vs object, overloading vs overriding, final keyword, inheritance, interfaces, exception handling, and comparisons between ArrayList and LinkedList. Additionally, it includes code examples for prime checking, string reversal, and calculating factorial using recursion.

Uploaded by

Cdt Pranay
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)
28 views2 pages

Java Technical Interview Cheat Sheet

This document is a Java Technical Interview Cheat Sheet covering key concepts such as the definition of Java, differences between JDK, JRE, and JVM, and features of Java. It also explains important topics like class vs object, overloading vs overriding, final keyword, inheritance, interfaces, exception handling, and comparisons between ArrayList and LinkedList. Additionally, it includes code examples for prime checking, string reversal, and calculating factorial using recursion.

Uploaded by

Cdt Pranay
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
You are on page 1/ 2

Java Technical Interview Cheat Sheet

1. What is Java?

Java is a high-level, object-oriented programming language. It is platform-independent due to the

JVM (Java Virtual Machine).

2. Difference between JDK, JRE, JVM

- JDK: Java Development Kit for development.

- JRE: Java Runtime Environment to run Java apps.

- JVM: Java Virtual Machine executes bytecode.

3. Features of Java

- Object-Oriented

- Platform Independent

- Secure

- Robust

- Multithreaded

- High Performance

4. Class vs Object

- Class: Blueprint for objects.

- Object: Instance of a class.

5. Overloading vs Overriding

- Overloading: Same method name, different parameters.

- Overriding: Redefining superclass method in subclass.

6. Final Keyword

- final variable: Value can't be changed.

- final method: Can't be overridden.

- final class: Can't be inherited.


7. Inheritance

Allows child class to inherit methods and fields from a parent class.

Example:

class Dog extends Animal

8. Interface

Interface in Java is used to achieve abstraction and multiple inheritance.

9. Exception Handling

Use try, catch, finally blocks to handle exceptions.

Example: try { int a = 10/0; } catch (Exception e) {}

10. ArrayList vs LinkedList

- ArrayList: Fast random access, slow inserts/deletes.

- LinkedList: Fast inserts/deletes, slow random access.

Code Example: Prime Check

int num = 29; boolean isPrime = true;

for (int i = 2; i <= num/2; i++) {

if (num % i == 0) isPrime = false; }

Code Example: Reverse String

String str = "Kamarta";

for (int i = str.length()-1; i >= 0; i--) {...}

Code Example: Factorial (Recursion)

int fact(int n) {

if(n==0) return 1;

else return n * fact(n-1);

You might also like