Core Java Fundamentals
Learn Java from the ground up: how the JVM runs your code, data types, operators, conditionals, loops, methods, arrays, strings, object-oriented programming and exceptions. Every lesson traces a real program line by line.
Java Basics
- Java History and Features: Learn about Java's origin, evolution, and key features that make it popular
- JVM, JRE, and JDK: Understanding the Java ecosystem components and their relationships
- Java Identifiers and Keywords: Learn the rules for naming variables, methods, and classes in Java, and understand the role of reserved words.
Data Types & Variables
- Primitive Data Types: Understanding Java's 8 primitive data types and their characteristics
- Non-Primitive Data Types: Explore how non-primitive (or reference) data types like Arrays, Strings, and Classes work in Java, focusing on how they are stored in memory.
- Variables and Memory Management: Understanding how Java manages variables in stack and heap memory
- Type Casting in Java: Understand how to convert data from one primitive type to another, covering both automatic (implicit) and manual (explicit) conversions.
- Variable Scope in Java: Understand the difference between local, instance, and class (static) variables, their lifecycles, and where they are stored in memory.
- Constants and Final Keyword: Learn how to create constants and prevent modification of variables, methods, and classes using the "final" keyword in Java.
Operators
- Arithmetic Operators: Learn the fundamental arithmetic operators in Java to perform mathematical calculations like addition, subtraction, multiplication, division, and finding remainders.
- Relational Operators: Learn how to compare values in Java using relational operators. These operators evaluate the relationship between two operands and return a boolean result (true or false).
- Logical Operators (&&, ||, !): Learn how to combine multiple boolean conditions using AND, OR, and NOT operators to create more complex decision-making logic.
- Assignment Operators: Learn how to assign and modify values of variables using basic and compound assignment operators.
- Increment/Decrement Operators: Learn how to use the pre-increment (++i), post-increment (i++), pre-decrement (--i), and post-decrement (i--) operators in Java.
- Bitwise Operators: Learn how to perform operations on the individual bits of integer-type numbers, a fundamental concept for low-level programming and optimization.
- Ternary Operator: Learn how to use the ternary operator, a compact, inline conditional for simple if-else logic.
- Operator Precedence: Understand the rules that dictate the order of operations in Java expressions, similar to PEMDAS or BODMAS in mathematics.
Conditional Statements
- Conditional Statements (if-else): Learn how to make decisions in your code using conditional statements
- Switch Statement: Learn how to use the switch statement to control the flow of execution based on the value of a variable or expression.
Loops
- For Loop: Learn how to execute a block of code a specific number of times using the for loop.
- While Loop: Learn how to repeat a block of code as long as a specified condition is true using the while loop.
- Do-While Loop: Learn about the do-while loop, a post-test (or exit-controlled) loop that guarantees the loop body is executed at least once.
- Enhanced For Loop (For-Each): Learn a simpler way to iterate over arrays and collections using the enhanced for loop, also known as the for-each loop.
- Nested Loops: Learn how to use loops inside other loops to handle more complex repetitive tasks, like working with two-dimensional data or creating patterns.
- Break Statement: Learn how to prematurely exit loops and switch statements using the break keyword.
- Continue Statement: Learn how to use the "continue" statement to skip the current iteration of a loop and proceed to the next one.
Methods
- Methods: Define, Call and Return: Package code into methods, pass values in, and get a result back. Watch each call get its own frame on the stack.
- Method Overloading: Several methods can share a name if their parameters differ. Java picks the right one from the arguments you pass.
- Pass by Value: Primitives vs References: Java always copies the argument. For an int that is the number; for an array it is the reference, so the method can change the array itself.
Arrays and Text
- Arrays: A fixed-size row of values on the heap. Create arrays two ways, fill them with an index, and loop over them with length.
- Two-Dimensional Arrays: An array of arrays: rows and columns. Mark cinema seats and count them with nested loops.
- StringBuilder: Changeable Text: Strings never change, so building text with + makes many throwaway objects. StringBuilder edits one object in place.
- Wrapper Classes and Autoboxing: Integer, Double and friends wrap primitives in objects so they can go into collections. Java converts back and forth automatically, with one trap.
Strings & Objects
- Java Strings: Creation and Immutability: A deep dive into how Java strings are created, stored in memory, and why they are immutable.
- Object Creation and References: Learn how objects are created and referenced in Java
Object-Oriented Programming
- Constructors and this(): Constructors set up a new object. Overload them, and let one call another with this(...) to avoid repeating code.
- static: Shared by the Whole Class: A static field belongs to the class, not to any one object. Count how many objects were made while each keeps its own clicks.
- Encapsulation: private Fields and Methods: Hide an object's data behind methods so it can never be put into a bad state, like a negative deposit.
- Inheritance and super: A Bike is a Vehicle. Reuse the parent's fields and methods, and call its constructor with super(...).
- Polymorphism and Overriding: One call, s.area(), runs different code for a Square and a Circle. Java picks the method from the real object, at run time.
- Abstract Classes: An abstract class is a partial blueprint: it can hold shared code, but leaves some methods for subclasses to fill in.
- Interfaces: An interface is a promise of methods. One class can keep several promises, and be used through any of them.
Exception Handling
- Exception Handling: try, catch, finally: Catch errors like division by zero or a bad array index so the program keeps running, and see finally run no matter what.
- Custom Exceptions and throws: Make your own exception type, throw it when a rule is broken, and make callers handle it with throws.