
Refresh your core java knowledge with a practical, framework-free refresher focused on essential syntax and features, control flow, and object-oriented concepts for back-end developers.
Trace Java's origin at Sun Microsystems and its development model that delivered write once, run anywhere by compiling to bytecode executed by the Java Virtual Machine.
Compare the JDK, JRE, and JVM to understand their roles in Java development. The JDK provides development tools and compiler, while the JRE runs bytecode and the JVM executes.
Java bytecode enables execution on any machine with a JVM. The JVM acts as a sandbox, enforcing boundaries that protect the host machine and improve security.
Discover how the JVM uses just-in-time compilation to convert bytecode to machine code on demand, and learn about interpretation and AOT as experimental options.
Explore five design goals of Java, including simplicity, object orientation, familiarity, robustness and security, architecture neutrality and portability, and high performance through the JVM with interpreted, threaded, and dynamic execution.
Install the JDK for Java development, select open JDK options like AdoptOpenJDK with versions 8, 11, and 14, set PATH and JAVA_HOME, and verify with java -version.
Set up IntelliJ IDEA Community Edition, create a Java project with a configured JDK, write a hello world with public static void main, and run.
Learn to run a simple hello world Java program from the command line without an IDE, including writing, compiling with javac, and executing with the java command on the JVM.
Discover JShell, a read-evaluate-print loop for ephemeral Java snippets in a command prompt. Type statements or create methods, see results instantly, and exit with slash exit to reset.
Review basic Java syntax by exploring the hello world program, the main method, and key terms such as public, static, void, main, and string[] args, illustrating how execution starts.
Explore variable declaration and assignment in Java, covering type-based declarations vs var inference, primitives and objects, initialization, retrieving values, and readable assignment patterns.
Explore Java's primitive types and how to use values directly, choosing byte, short, int, or long for numbers without objects, and float or double for decimals, char and boolean true/false.
Explore Java primitive number types from 32-bit int to 64-bit long, and floating point double and float, with byte and short used less often.
Explore how literals define values directly in code for primitives, including binary and underscore-separated integers, double literals with exponents, boolean and char literals, and string literals.
Explore how Java enforces strong static typing at compile time, ensuring variables hold only declared types, and learn about compatible types and automatic type conversions like int to double.
Learn how to use casting to force conversions between primitive types, recognize safe widening from smaller to larger capacity, and handle narrowing with explicit casts to avoid runtime errors.
Learn casting and lossy conversions in Java, including primitive and object references, when incompatible casts throw runtime exceptions and compatible casts may drop decimals.
Explore how precision loss occurs when casting from higher to lower capacity numeric types and during integer division, and how runtime evaluation affects results in Java.
Understand automatic type promotion in Java, where mixed-type expressions promote to the most promoted type, converting all operands to that type and potentially losing precision.
Java arrays store values of a type, allocated with type[size], and accessed by zero-based indices. Use brace convention to initialize; int can promote to double, but int arrays cannot convert.
Explore multidimensional arrays in Java, learning how to declare two dimensional arrays, initialize the first or second dimension, create three dimensional arrays, and work with jagged arrays.
Explore Java operators, including arithmetic and assignment operators with plus-equals and increment/decrement, prefix and postfix forms, relational and equality checks, logical operators, the ternary operator, and operator precedence.
Explore how blocks in Java use curly braces to group statements and define the scope of local variables inside a block, including if statements and loops.
Explore Java flow statements that control program execution, including if statements with conditions and blocks. Use else and else-if ladders or switch statements for multiple conditions, with nesting of ifs.
Explore how the classic switch statement routes execution using cases and breaks, with a default, fall-through behavior, and support for primitive types, strings, and enums.
Explore the Java 14 switch expression, an arrow-based construct that returns a value without breaks for enum days like Monday through Sunday.
Explore the classic for loop, including initialization, a boolean condition, and an action per iteration, with multiple statements and scoped loop variables to avoid infinite loops.
Explore the for-each loop syntax, iterating over arrays and sets in Java. Read values from a collection without modification, accumulate totals, and rely on type inference.
Explore nested loops on two-dimensional arrays, comparing classic for with index updates to for-each for reading elements, and learn when to choose each in Java.
Compare while and do-while loops in Java: while checks the condition before executing, while do-while runs the block and then tests the condition to continue as long as true.
Learn how break and continue alter loop flow in Java, ending a loop versus skipping the current iteration and resuming at the top with clear examples.
Explore how curly braces define scope in Java, with if blocks and loops restricting variables to their block, and show when to declare outside to access them.
Explore how Java models real and business entities with classes and objects, defining their state and behavior as templates, and create multiple object instances from a class.
Define a class with member variables and methods, create object instances with the new keyword, and apply captain camel case for classes and camel case for variables, illustrating per-instance state.
Explore how object references allocate memory for new instances, distinguish references from pointers, and show how variables can point to car instances, be reassigned, or hold a null value.
Classes are blueprints for objects, defining instance variables and methods, forming a type, while new allocates memory at runtime to create an object instance, with references pointing to that instance.
Explore how variable shadowing occurs when method arguments share names with instance variables and use the this reference to distinguish the instance field from the parameter.
Learn how constructors initialize new objects in Java, covering no-argument and parameterized constructors, overloading, and using this() to chain constructors and set default values.
Explains that instance variables can reference other objects, such as strings and arrays of object references. Demonstrates the copy constructor pattern by copying values from another car instance into itself.
Explain how Java passes parameters by value for primitives and for object references, copying the value or the reference, since Java is not call-by-reference.
Group classes and interfaces into packages to prevent name collisions, organize code, and mirror the package in the source directory with no hierarchy, using a reverse domain name.
Learn how to use the import statement to access classes from different packages, when to use fully qualified names, and how star imports bring in all package classes.
Explore how Java access modifiers control access to member variables and methods, enabling encapsulation through public, private, protected, and package-private access, and how inheritance affects visibility.
Explore best practices for Java access modifiers, treating a class as a contract, keeping state private, and exposing it via getters and setters while using public, protected, or package-private judiciously.
Understand how the static modifier assigns class members to the class rather than instances, enabling a program’s main entry point, shared values, and class-wide access without an object.
Use the final modifier to declare variables and references as constants, preventing reassignment while enabling runtime optimizations. It also promotes readability with all-caps names and helps avoid magic values.
Explore Java nested classes, including static nested classes, inner classes, local classes, and anonymous classes, with examples of scope, naming, and usage to keep related code together.
Explore how local classes access outer scope variables and why only final or effectively final values can be referenced, due to closure and variable copying at instantiation.
Examine inheritance and polymorphism in Java by building a common animal superclass and specific dog, cat, and rabbit subclasses, using extends and the inheritance hierarchy.
A subclass extends a single superclass, inheriting its defined members while remaining a separate class; Java prohibits multiple inheritance to avoid diamond problems and simplify debugging.
Examine how public, protected, private, and default access modifiers shape what a subclass can access from its parent when inheriting in the same package.
Learn how the super keyword allows a subclass to access inherited fields from the superclass when a subclass defines a field with the same name.
Learn how method overriding lets a subclass replace inherited methods with the same signature to tailor behavior, while avoiding changes to return type or weaker access modifiers.
Explore how the override annotation in Java conveys intent and prompts the compiler to verify you override a method, preventing signature errors and improving code readability.
Use a concrete animal example to show inheritance: a base animal with age and species, and overridden move method in fish and birds.
Explore how encapsulation and inheritance interact in Java by comparing private seats, inherited run methods, and public getters and setters that proxy private data through overridden methods and access modifiers.
Explore how constructors execute in inheritance, including default no-arg constructors, automatic super calls in the inheritance chain, and using super with arguments.
See how abstract classes prevent direct instantiation and define shared behavior in an animal-pet inheritance hierarchy, where dog, cat, and rabbit extend animal or pet.
Abstract methods define a contract with a signature but no body, such as a public move method. Subclasses must implement it, or remain abstract, and abstract classes cannot be instantiated.
Explore how the final keyword controls constants, prevents class inheritance, and blocks method overriding in Java, and apply these rules to design robust classes.
Explore how Java interfaces define a class's contract separate from internal implementation, and how a class implements the interface by providing drive and refuel method bodies that match the interface.
Discover how interfaces enable a class to implement multiple contracts, extend a single class, and include global constants, with examples like drivable and fuel vehicle.
Compare interfaces and abstract classes, learn when to use each, and how interfaces express a contract while abstract classes serve as templates for related classes; you can't instantiate either.
Learn how Java interfaces use default methods like drive, how implementing classes can override them, and how to resolve conflicts when multiple interfaces provide defaults.
Explore how interfaces define contracts across classes, support extends and multiple implementations, and provide default and static methods, constants, and private helpers for internal use.
Explore polymorphism in Java by treating subclass instances such as lion, bird, or fish as a superclass reference and calling the shared move method, yielding subclass-specific motion.
Explore polymorphism by assigning a lion to an animal reference and invoking only animal methods. Observe that lion-only methods stay inaccessible, while inherited and overridden animal methods demonstrate polymorphism.
Demonstrate polymorphism with interfaces by showing a sports car class implementing drivable and fuel vehicle interfaces, exposing only drive and refuel methods when referenced as an interface.
Cast object references to access specific behaviors, such as refueling a fuel vehicle cast from a drivable reference. Note runtime safety and potential type errors.
Shows how is a relationship in polymorphism lets a subclass extend a superclass, so a fish is an animal, and interfaces enable assigning to a reference by capabilities like drivable.
Explore how super refers to inherited members and how every class automatically extends the object class, bringing standard methods like toString and equals into your Java objects.
Explore how Java's toString returns a string representation of an object. Override toString to display meaningful details like a car's make and model.
Override the equals method in Java to compare object contents rather than references, checking for same object, nulls, class, then comparing key fields like seats and make.
Learn how to implement exception handling in Java by planning for runtime errors, defining a happy path and alternate execution when things go wrong, including divide by zero scenarios.
In Java, exceptions begin as an exception object that is created and thrown, then handled by protecting risky code, defining an alternate path, and performing cleanup no matter what.
Master the Java try-catch block to handle exceptions, using a try block for risky code, a catch block for the exception, and an optional finally for cleanup.
Learn how Java handles errors with multiple catch blocks, matching exceptions by type, leveraging polymorphism, and using finally blocks, including nested try-catch scenarios.
Explore how the throw keyword creates and signals exceptions, how try-catch blocks guard code, and how exceptions bubble up the call stack to a default handler.
Explore the Java exception hierarchy from throwable to runtime exception, differentiate errors as non recoverable issues, and learn when to use checked versus unchecked exceptions and try-catch.
Create custom runtime and checked exceptions in Java by extending runtime exception or exception, throwing them, and using method signatures with throws or try-catch to guide consumer error handling.
Explore throwable and inherited methods in Java exceptions, focusing on constructors, including message and cause, and learn exception chaining, stack traces, and custom exception patterns.
Learn best practices for exception handling: avoid generic catches, use specific exceptions, apply exception chaining for libraries, order catches, prefer checked over unchecked, and clean up with finally or try-with-resources.
Capture core Java coverage from language goals, the JVM and JDK, setup, and just-in-time and ahead-of-time concepts, plus variables, operators, control flow, and exception handling.
Explore the Java library API, collections API, and generics to deepen your Java skills, then explore lambdas and other courses on the Java learning path to continue mastering Java.
Have you learnt Java on the job and never had a formal introduction to the language? Don't know what you don't know in Java?
This course is just for you! Get a complete overview of all the basics of Java that you need to know. Including strong foundational understanding of Core Java and makes you ready for interviews. It also addresses any gaps in your knowledge of the language to get you ready to tackle and learn advanced topics.
This is a course you'll wish you watched sooner!
Watch this course anytime you need to brush up your Java skills. This course is perfect for brushing up all the Java basics before attending interviews!
Taught in the inimitable Java Brains style, this course covers the language syntax basics to Object Oriented programming concepts to exception handling concepts.
Section 1 introduces to the overall Java language ecosystem tackling the JRE, JVM and JDK.
Section 2 introduces you to the setup process to start coding in Java on your computer
Section 3 covers variables and types. Dive into the data types available in Java, understand literals, arrays operators and variable scoping
Section 4 runs through all the essential control structures in Java that you need to know
Section 5 gets you started with Object Oriented programming in Java with classes and objects. Learn about object instances, references, the this reference, variable shadowing and constructors.
Section 6 covers conceptual and practical implications of Object Oriented programming and the associated concepts of encapsulation and access restrictions. Learn about access modifiers, static and final key words and local classes.
Section 7 covers inheritance and polymorphism - access modifiers, inheritance, overriding, interfaces, abstract classes default methods, casting, the toString and equals methods.
Section 8 is all about exception handling. Learn the fundamental syntax structures that allow you to throw as well as catch exceptions. Learn how to create exception classes and best practices for handling exceptions.
After you finish this course, check out the Java Brains' Java 8 Lambdas course to take your Java learning to the next level!