JAVA COMPLETE NOTES (Student Style)
1. Introduction to Java
Java is a high-level, object-oriented programming language developed by Sun
Microsystems in 1995. It is platform independent because it uses JVM (Java Virtual
Machine).
Features of Java
• Simple
• Object Oriented
• Platform Independent
• Secure
• Robust
• Multithreaded
• Portable
2. Java Architecture
Java program → Compiler → Bytecode → JVM → Output
3. Data Types
Primitive Data Types:
int, float, double, char, boolean, byte, short, long
4. Variables
Variables are used to store data values.
Types: Local, Instance, Static
5. Operators
Arithmetic, Relational, Logical, Assignment, Unary
6. Control Statements
if, if-else, switch
Loops: for, while, do-while
7. OOP Concepts
• Class
• Object
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
8. Class and Object
Class is a blueprint of object. Object is an instance of class.
9. Constructors
Constructor is used to initialize object. Types: Default, Parameterized.
10. Inheritance
One class acquires properties of another class using 'extends' keyword.
11. Polymorphism
Ability of method to take multiple forms. Types: Compile time, Runtime.
12. Abstraction
Hiding implementation details using abstract class and interface.
13. Encapsulation
Wrapping data and code together using private variables and getters/setters.
14. Interfaces
Interface is a collection of abstract methods. Implemented using 'implements'.
15. Packages
Package is a group of related classes and interfaces.
16. Exception Handling
Handled using try, catch, finally, throw, throws.
17. Multithreading
Executing multiple threads simultaneously using Thread class or Runnable interface.
18. File Handling
Used to read and write data using File, FileReader, FileWriter classes.
19. Collections Framework
List, Set, Map, ArrayList, HashSet, HashMap.
20. JDBC
Java Database Connectivity is used to connect Java with database.
Conclusion
Java is widely used in web, mobile, desktop and enterprise applications.