
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Beginner-friendly, hands-on Java course guides you from fundamentals to projects, mastering object-oriented concepts like classes and inheritance, and building apps with Spring, Maven, and JPA through active learning and practice.
Master the fundamentals of Java programming and object-oriented principles through hands-on exercises, solve puzzles, and prep for interviews, then build REST APIs with Spring, Spring Boot, JPA, and Hibernate.
Install Java on your local machine by following OS-specific steps for Windows, Mac, or Linux to set up the essential foundation, with troubleshooting if needed.
Install the latest Java JDK on Windows from Oracle, run the x64 installer, accept defaults, and verify installation with java --version and jshell --version; troubleshoot if needed and continue.
Install Oracle JDK on macOS by downloading the macOS DMG from the Java downloads page (ARM64 for Apple Silicon or Intel x64) and verify with java --version and jshell --version.
Install the latest Oracle JDK on Linux by selecting the appropriate Debian or RPM package for your architecture. Verify installation with java -version and jshell -version to begin programming.
Troubleshoot Java installation by following Java SE downloads and Windows path setup. Verify path and bin folder, reinstall to default location, and check java-version and jshell-version commands.
Learn problem solving in Java by understanding the problem, designing a solution, and breaking big tasks into smaller steps, then writing and testing the program with language specifics and patience.
Print the five multiplication table from 1 to 10 using JShell. Learn core concepts including statements, expressions, variables, if statements, for loops, and methods.
Use JShell, Java's REPL, to run single lines and see immediate results, then practice logging in and out to explore APIs before Eclipse.
Break down the multiplication table challenge by calculating 5 * 1 through 5 * 10 and printing the full table with a step-by-step plan.
Learn Java expressions in JShell, mastering operands, literals, and operators (+, -, *, /, %) through simple arithmetic, with exercises to compute minutes and seconds in a day.
Solve Java expressions by calculating minutes in a day (24 * 60 = 1440) and seconds (24 * 60 * 60 = 86400), using arrow navigation to review previous steps.
Explore Java expressions through puzzles that teach operators, precedence, and type behavior, showing how integer vs floating-point division works and how brackets clarify calculations for beginners.
Learn how to print calculated results and literal text to the JShell console using System.out.println(), including understanding expressions, string literals, and the method call syntax.
Practice printing with Java using system.out.println to display Hello world, 5*3 as an expression, and 15 as a value, then cover the table of 5 and seconds in a day.
Master printing output in Java with System.out.println, using string literals like Hello World and expressions like 5*3 and 24*60*60; understand syntax and the role of operands and operators.
Explore Java print output by mastering System.out.println, string spaces, and escape characters, then practice method invocation with Math.random, Math.min, and Math.max.
Explore how JShell supports multi-line input, completing incomplete statements and printing with System.out.println, including using semicolons to combine statements and braces for blocks.
Learn to print calculated values to the console using System.out.printf, replacing literals with format specifiers like %d, and compare it with println for advanced Java output.
Practice using System.out.printf to print calculations to the console, mastering %d, %s, and %f format specifiers, handling argument counts and ignoring extra parameters while preparing the multiplication table exercise.
Explore how variables work in Java by declaring int numbers, performing assignments, and using System.out.printf to print the five multiplication table as i changes.
Declare int a, b, and c and print their sum to see values update. Learn Java's strong typing and the need to declare variables before use, avoiding undeclared variables.
Explore how variables are stored in memory, learn naming rules and best practices, and examine primitive types and key assignment operators across four focused videos.
Visualize variables as named boxes tied to memory locations, storing values of specific types. See how assignments copy values between memory locations and how Java requires declaring a type.
Learn Java variable naming rules: valid characters are letters, digits, $, and _, cannot start with a digit or be a keyword. Use camelCase like noOfGoals for names like score.
Explore Java primitive variable types, including byte, short, int, long, and their ranges and memory usage; learn when to choose each for integers, plus float, double, char, and boolean.
Choose the right primitive types for Java data: use byte/short/int/long for integers, double or float for decimals, char for grades, and boolean for true/false.
Learn how strings and the plus operator work in Java, when addition versus concatenation occurs. Explore left-to-right evaluation, printing values with System.out.println, and note that string concatenation can be costly.
The assignment operator copies the right-hand value into the left-hand variable, as shown by i = j and i = i + 1, illustrating incrementing.
Master increment and decrement operators, including pre- and post- forms, and apply compound assignment operators like +=, -=, *=, /=, and %; practice puzzles show how numbers change.
Explore JShell shortcuts and multi-line support to get immediate feedback, navigate history with arrows, search with control R, and manage variables like $2 and $4.
Explore Java conditionals and the introduction of the if statement, defining boolean conditions and executing code only when conditions such as i < 5 or number2 > number1 are true.
Practice and master if statements by solving exercises that compare sums of variables a, b, c, d, validate triangle angles, and detect even numbers using the modulus operator.
Practice java conditionals with if statements, comparing sums like a + b > c + d, validating triangle angles with ==, and determining even numbers using % 2.
Explore Java conditionals and if statements, clarify assignment versus comparison, and demonstrate using blocks to group statements under a condition and print outcomes.
Demonstrates implementing a for loop in Java to print a 5 times table from 5 times 1 to 5 times 10, detailing initialization, condition, and update.
Advance your Java for loop skills with exercises to print multiplication tables (5, 7, 6, 10); print numbers 1–10 and 10–1; and square the first 10 numbers, even and odd.
Control the for loop to print multiplication tables using a table variable, and explore printing 1 to 10, 10 to 1, and squares with JShell for quick feedback.
Explore Java for loops, including empty initialization and update, multiple statements, and infinite loops. See how blocks print No 1 and No 2 and keep code maintainable.
Revise core Java terminology, including integer and decimal literals, expressions, statements, and variables. Review assignment operators, conditions, for loops, and built-in methods like System.out.printf and System.out.println.
Explore how to create a method for a set of code lines, define inputs and outputs, and share a multiplication table implementation.
Learn to define and call your first Java method with a void return type, printing Hello World twice, and complete exercises to print four statements and Hello World thrice.
Explore practical exercises on creating Java methods, naming conventions, and printing with System.out.println, including void methods, camelCase, and common pitfalls like keywords and bracket syntax.
Discover tips for editing methods in JShell, including saving with /save, backing up to backup.txt, and using /edit to modify sayHelloWorldTwice or printLearningExperience.
Create a sayHelloWorld method with an int parameter to print hello world as many times as the argument using a for loop.
Create and run Java methods printNumbers and printSquaresOfNumbers that accept an int argument to print numbers from 1 to n and their squares.
Explore puzzles about Java method arguments, showing why zero or mismatched arguments cause errors, and learn the difference between parameters (in declaration) and arguments (in invocation), using sayHelloWorld.
Create a Java method named printMultiplicationTable to print the table using a for loop and System.out.printf, with 5 as the default and future support for a parameter.
Learn to implement a printMultiplicationTable method with a parameter to print any multiplication table and apply method overloading to support a default 5 table or a specific table.
Learn how to pass multiple parameters to Java methods, handle return values, and create sum methods for two and three numbers, then print results with System.out.println.
Explore how Java methods return values, use return to pass results to variables, contrast with void methods that print, and handle method overloading by renaming when returning values.
Explore returning values from Java methods with two exercises: sum of three numbers and calculating the third angle of a triangle using 180 degrees, via well named methods.
Explore the fundamentals of Java methods by defining, calling, and returning values, including no, one, or multiple parameters, and understand that a method can return only one value.
Consistent, short daily study improves long-term retention better than long weekend sessions. Create a two-week plan with specific lecture ranges and place it where you see it daily.
Explore running Java programs outside JShell, learn how to compile and execute, and demystify JDK, JRE, JVM, and the concept of a class on the Java platform.
Explain how Java compiles code into bytecode and uses the Java virtual machine to achieve platform independence, enabling programs to run across Windows, Unix, and Linux.
Learn how a Java class acts as a template to create objects, as shown with Country and Planet, and master the syntax to instantiate india = new Country().
Define a revolve method in the planet class and call it on earth and venus objects, illustrating that non-static methods require an instance; try a comingSoon method in country class.
Move Java code from JShell to Planet.java, save and compile with javac to produce Planet.class, and verify class name matches file name and proper folder setup.
Learn to run a Java program by compiling Planet.java with javac and executing java Planet, ensuring public static void main with String[] args to run revolve on Planet.
Master compiling and running a Java file with the exact main method signature public static void main(String[] args), diagnose common compilation errors, and understand JShell versus javac/java execution.
Understand how the JVM executes bytecode as machine instructions, while the JRE adds libraries and the JDK adds compilers and debuggers for development, enabling platform independence.
Meet Ranga Karanam, founder of in28minutes and your primary instructor, with two decades of programming in Java, Python, and JavaScript, cloud certifications, and a passion for simplifying technology.
Install Eclipse on Windows by downloading Eclipse packages from Eclipse downloads, selecting Eclipse IDE for Enterprise Java and web developers, then extract, move to C or D, and run Eclipse.exe.
Download eclipse from eclipse.org/downloads/packages and choose eclipse ide for enterprise java and web developers on macOS. Drag into applications, rename to 2021-03, and launch to complete the first-time setup.
Launch Eclipse and create a new Java project within a workspace, name the project, choose Java SE-9, and open the Java perspective to view the project structure.
Create your first Java class in Eclipse, organize it in a package such as com.in28minutes.firstjavaproject, add a public static void main that prints Hello World, and run it with Eclipse.
Build a Java multiplication table in Eclipse by creating a MultiplicationTable with a print method and a MultiplicationTableRunner with a main method, using printf formatting.
Generalize the multiplication table program by adding an overloaded print method that accepts the table as a parameter and supports from and to parameters, replacing hard-coded values.
Explore eclipse save actions, configure preferences to automatically organize imports and format code on save, and enforce coding standards such as trailing whitespace handling and for-loop style.
Skip creating modules in a new Java project for now; ignore the module name prompt and proceed with the project. Plan to discuss modulization and module-info.java later in the course.
Explore refactoring with Eclipse to eliminate duplication in a multiplication table example by consolidating similar print methods into a single print table method, enabling changes in one place.
Master eclipse debugging by stepping over and into code with breakpoints, and by exploring call stacks, variables, and debug views.
Explore Eclipse shortcuts like Ctrl+N, Ctrl+Shift+L, and Ctrl+ShiftR to navigate and create code, and compare writing Java programs in Eclipse versus using JShell.
Technology evolves daily, so stay ahead by learning every day and building a 28-day habit with the in28minutes Learning Pledge to study 28 minutes daily.
Master Java by practicing with Udemy coding exercises on the platform, where you run tests, receive hints and solution videos, and learn without needing an external IDE.
Discover ten rules for happy programmers, from embracing challenges and accepting failure to practicing, staying patient, breaking problems down, persisting, celebrating progress, and staying curious.
Write a Java program with a main method that prints Hello World to the console using System.out.println, and fix common syntax issues to pass the test.
Implement and test a TimeConverter in Java by finishing two static methods: convertHoursToMinutes and convertDaysToMinutes, handling negative inputs by returning -1 and validating via tests.
Learn to implement exam result checker in java by coding isPass to return true when marks exceed 50 and false otherwise, with tests for 49, 50, 51, and 100.
Implement calculateSumOfSquares to return the sum of i*i for i from 1 to n (the first N numbers) stored in a long, and return -1 if n is negative.
Learn the origin of in28minutes and its view of change as an opportunity, its inquisitive approach, and daily learning of about 28 minutes every day.
Explore how object-oriented programming reshapes thinking from procedural approaches by examining classes, objects, state, and behavior, and learn core concepts like encapsulation and abstraction with practical examples.
Object-oriented programming centers on objects with data and actions, unlike procedural programming's function focus, illustrated by a flight example with aeroplane, passenger, and crew.
Explore the core terminology of object-oriented programming, including class template, object instances, member data state and fields, and behavior through methods, with examples of planet, earth, and venus.
Identify objects in an online shopping system for object-oriented programming, including customer, shopping cart, product, and person, along with their data and actions.
Create a motorbike class in Java to model speed and gears, instantiate ducati and honda, and explore class, object, state, and behaviour with a start method.
Create a Book class and a Book Runner with a main method, instantiate three books using camelCase like effectiveJava and cleanCode, following class capitalization and variable naming rules.
Learn how an object's state is stored in an instance variable speed, using ducati and honda, with each bike keeping its own speed in memory as it changes.
Encapsulate a speed field by making it private and expose it through a setter method, setSpeed, ensuring external code cannot modify data directly.
Explore encapsulation by restricting access to motorbike data, using setSpeed and getSpeed; learn code generation in Eclipse to generate getters and setters for all fields.
Explore puzzles about member variable initialization and speed handling by tracing setSpeed and getSpeed on Ducati and Honda, including defaults, outputs, and debugging with breakpoints.
Encapsulation uses methods and setters to prevent invalid object states, such as negative speed, by validating input and guarding data from other classes, with exceptions planned for invalid actions.
Explore encapsulation by moving speed logic into the motorbike class, adding increaseSpeed and decreaseSpeed methods to prevent duplication and safely update Ducati and Honda speeds.
Explore encapsulation level two by centralizing validation inside the class, using setSpeed to guard speed and updating noOfCopies methods to ensure positive values.
Learn how abstraction hides complexity in programming and how it relates to encapsulation. See Java concepts and the bike analogy illustrate how code runs on the JVM.
Explore constructors in Java by creating a MotorBike object with initial speeds of 100 and 200, using this.speed to set the state, with no return type.
Create a book constructor and instantiate with Book(100), Book(50), and Book(40) to initialize noOfCopies; learn how the compiler provides a default constructor and how this(5) chains constructors.
Explore core object oriented programming concepts by examining classes, objects, how to add data and behavior, and the operations you can perform, with an introduction to encapsulation and abstraction.
Try harder and troubleshoot on your own to build resilience, then search errors on Google, take a break if stuck, and post detailed questions in the course Q&A.
Implement the Dimension class in Java to convert inches into feet and inches, via a constructor, and getters getFeet and getInches, handling negative input by returning -1 for both.
Implement a Square class with a constructor and methods to calculate area and perimeter, validating non-positive sides and returning -1 for invalid input.
Develop a point class with 2d coordinates x and y, implement move to adjust position by dx and dy, and distanceTo to compute the Euclidean distance using Math.sqrt.
Implement an rgb color class by defining red, green, and blue components (0-255), adding constructor and getters, and implementing invert by subtracting each component from 255.
Balance hard work with regular breaks through treks in India, Nepal, Switzerland, Italy, and Austria, including the Annapurna Base Camp Trek near Pokhara. Share how you chill in the Q&A.
LEARN JAVA PROGRAMMING WRITING 200+ JAVA PROGRAMS, PUZZLES & EXERCISES. Get Interview Ready!
RECOMMENDED for absolute beginners to Java and Programming!
BONUS - Java Interview Guide with 200+ Questions and a companion website
BONUS - Learn to Build REST API with Spring, Spring Boot, and JPA
8 Things YOU need to know about this JAVA PROGRAMMING Course
#1: Nearing 300,000 Learners - One of the highest-rated Java Courses on Udemy!
#2: Designed for ABSOLUTE BEGINNERS to Java Programming (Core + Advanced)
#3: HANDS-ON - Write 100+ Programs - The best way to learn Java Programming is to get your hands dirty!
#4: PUZZLES and EXERCISES to help reinforce your learning
#5: One of the first courses to be updated to JAVA 24. Covers all new features in Java 9, Java 10, Java 11, Java 12, Java 13, Java 14, Java 15, Java 16, Java 17, Java 18, Java 19, Java 20, Java 21, Java 22, Java 23 and Java 24.
#6: FREE 150 Page Course Companion Web Site
#7: BONUS - Learn to Build REST API with Spring, Spring Boot, and JPA (Hibernate)
#8: BONUS - Java Interview Guide with 200+ Questions and a companion website
WHAT OUR LEARNERS ARE SAYING:
5 STARS - The best Java course out there for Beginners. Highly recommended.
5 STARS - This course exceeded all my expectations. HIGHLY RECOMMENDED!
5 STARS - Great mix of theory and exercises!
5 STARS - What a great course!!!
5 STARS - This is the best Java course I've come across. It's straight to the point without any missing details. You can get an idea of what you're getting into working with Java fast with this course. I really like it.
5 STARS - Never thought taking an online course will be so helpful. The instructor is quite engaging, gives a good amount of exercises.
5 STARS - This course is wonderful! I really enjoy it. It really is for beginners, so it's very helpful for people which don't know anything about programming.
5 STARS - It's very well thought out. I enjoy the constant exercises and the challenge they present to make things happen.
COURSE OVERVIEW
Java is one of the most popular programming languages. Java offers both object-oriented and functional programming features.
We take a hands-on approach using a combination of JShell and Eclipse as an IDE to illustrate more than 200 Java Coding Exercises, Puzzles, and Code Examples. This course assumes no previous ( beginner ) programming or Java experience. If you’ve never programmed a computer before, or if you already have experience with another programming language and want to quickly learn Java, this is a perfect course for you.
In more than 250 Steps, we explore the most important Core Java Programming Language Features
Basics of Java Programming - Expressions, Variables, and Printing Output
Java Operators - Java Assignment Operator, Relational and Logical Operators, Short Circuit Operators
Java Conditionals and If Statement
Methods - Parameters, Arguments, and Return Values
Object-Oriented Programming - Class, Object, State, and Behavior
Basics of OOPS - Encapsulation, Abstraction, Inheritance, and Polymorphism
Basics about Java Data Types - Casting, Operators, and More
Java Built-in Classes - BigDecimal, String, Java Wrapper Classes
Conditionals with Java - If Else Statement, Nested If Else, Java Switch Statement, Java Ternary Operator
Loops - For Loop, While Loop in Java, Do While Loop, Break and Continue
Immutability of Java Wrapper Classes, String and BigDecimal
Java Dates - Introduction to LocalDate, LocalTime and LocalDateTime
Java Array and ArrayList - Java String Arrays, Arrays of Objects, Primitive Data Types, toString and Exceptions
Introduction to Variable Arguments
Basics of Designing a Class - Class, Object, State and Behavior. Deciding State and Constructors.
Understanding Object Composition and Inheritance
Java Abstract Class and Interfaces. Introduction to Polymorphism.
Java Collections - List Interface(ArrayList, LinkedList and Vector), Set Interface (HashSet, LinkedHashSet and TreeSet), Queue Interface (PriorityQueue) and Map Interface (HashMap, HashTable, LinkedHashMap and TreeMap() - Compare, Contrast and Choose
Generics - Why do we need Generics? Restrictions with extends and Generic Methods, WildCards - Upper Bound and Lower Bound.
Functional Programming - Lambda Expression, Stream and Operations on a Stream (Intermediate Operations - Sort, Distinct, Filter, Map and Terminal Operations - max, min, collect to List), Functional Interfaces - Predicate Interface, Consumer Interface, Function Interface for Mapping, Method References - static and instance methods
Introduction to Threads and MultiThreading - Need for Threads
Implementing Threads - Extending Thread Class and Implementing Runnable Interface
States of a Thread and Communication between Threads
Introduction to Executor Service - Customizing the number of Active Threads. Returning a Future, invokeAll, and invokeAny
Introduction to Exception Handling - Your Thought Process during Exception Handling. try, catch, and finally. Exception Hierarchy - Checked Exceptions vs Unchecked Exceptions. Throwing an Exception. Creating and Throwing a Custom Exception - CurrenciesDoNotMatchException. Try with Resources - New Feature in Java 7.
List files and folders in Directory with Files list method, File walk method and find methods. Read and write from a File.
Covers Java New Features from Java 8 to Java 25 (incl. Java 17, Java 21)
Java 8 – Embraced functional programming with Lambda expressions and Streams.
Java 9 – Introduced modularization to the Java Platform - enabling faster startup and less memory footprint for Java applications
Java 10 to NOW – Started the six-month release cycle for faster updates and quick feedback. (Java 10 to Java 25 to ..)
Java 11 to NOW – Reduced code verbosity
Switch Expressions – More concise conditional logic. (Java 14)
Text Blocks – Simplifies multi-line strings. (Java 15)
Records – Reduces boilerplate for data objects. (Java 16)
Pattern Matching – Enhances code readability and conciseness. (Java 16)
Sealed Classes - Controlled inheritance of your class hierarchies. (Java 17)
Unnamed Variables & Patterns – Allows ignoring unused variables in code. (Java 22)
Markdown Documentation Comments – Enhances Javadoc with Markdown support (Java 23)
Stream Gatherers – Introduces new ways to aggregate stream data. (Java 24)
Java 21 to NOW:
Project Loom – Virtual threads for high-performance concurrency. (Java 21)
Cloud & Container-Ready – Optimized for modern cloud-native applications.
Start Learning Now. Hit the Enroll Button!