Java Interview Cheat Sheet (Simple & Easy Language)
1. Basics of Java
Java is a programming language that is simple, secure, object-oriented and platform-independent
(can run anywhere).
2. OOP Concepts
4 main ideas:
- Class & Object
- Inheritance
- Encapsulation
- Polymorphism
- Abstraction
3. Data Types & Variables
Different data types like int, float, char, boolean. Variables hold data values.
4. Operators
Arithmetic (+, -, *), Relational (==, !=), Logical (&&, ||), Assignment (=, +=).
5. Control Statements
if-else, switch, for, while, do-while loops to control flow of programs.
6. Arrays
Collection of similar data types. Example: int[] numbers = {1, 2, 3};
7. String Handling
Strings are text. Use methods like length(), charAt(), toUpperCase().
8. Exception Handling
Errors are managed using try-catch blocks to prevent program crash.
9. Inheritance
Child class inherits features from Parent class. Example: Bike extends Vehicle.
10. Polymorphism
One thing, many forms: Method Overloading & Method Overriding.
11. Encapsulation
Hide data using private variables and use getter & setter methods.
12. Abstraction
Show only necessary details, hide the rest. Done using abstract classes & interfaces.
13. Interfaces & Abstract Classes
Interface: all methods are abstract. Abstract Class: can have both abstract & normal methods.
14. Collections Framework
List (ordered), Set (no duplicates), Map (key-value). Examples: ArrayList, HashSet, HashMap.
15. Multithreading
Run multiple tasks at once. Example: two cooks in one kitchen.
16. File Handling
Read & write files using File, FileReader, FileWriter classes.
17. Java 8 Features
Lambda Expressions, Streams, Functional Interfaces, Method References.