
Learn to download, install, and configure the JDK on Mac and Windows environments. Then set up the JDK, a text editor, and IBT for hands-on practice.
Install the java development kit on macOS by downloading from the browser or via terminal. Verify installation with java -version and javac -version, and use editors like MacVim or Sublime.
Install the JDK and NetBeans on mac, download the macOS installer, and verify Java 14 with java -version before launching NetBeans.
Test your JDK and NetBeans on mac by creating a Java application project, activating the JDK and plugins, and running a hello world program through the main method.
Learn to install the Java development kit on Windows, set JAVA_HOME, PATH, and CLASSPATH, and test by compiling and running a Hello world program with javac and java.
Download and install NetBeans on Windows, accept the license, set up with JDK 14, create a Hello World Java project from templates, run it, and explore the project directory.
Write your first Java program, a HelloWorld class with a main method using System.out.println to print text. Save as HelloWorld.java in Java codes folder, then javac and java to run.
Learn to identify and fix common java errors in compilation and runtime, including file name versus public class name and the public static void main(String[] args) entry point.
Explore the parts of a Java program, including class and main, using System.out.print/println, plus for numbers and strings, and declare int X to print 'X equals 50' with backslashes.
Explain class versus object by defining a person class with name and age. Show how to instantiate objects with a test class, an instance method say hi, and constructors.
Instantiate two objects with their own instance variables and the say hi method, assign names and ages, and compile the code to see two objects outputting their greetings.
Explore constructors in Java: how to declare a constructor with the class name, use new to instantiate objects, understand default versus custom constructors, and overload constructors with arguments.
Explore the anatomy of a Java method, including modifiers, return type, name, and parameters, with examples of setters, getters, and birthday increment methods.
Master encapsulation by turning fields private and exposing public getters and setters with validation. Learn how data hiding protects variables and enforces safe values in Java.
Understand the purpose and structure of the Java API documentation, including online and offline Javadoc resources, how to access packages and classes, and how constructors are defined.
Explore the import statement, using the Scanner for user input with System.in and System.out, and understand default package versus importing specific or all classes with an asterisk.
Explore popular Java integrated development environments like Eclipse, NetBeans, and IntelliJ IDEA, and learn core concepts such as package statements, comments, semicolons, white space, primitive and reference types, and scanner.
Create your first NetBeans Java project, write a hello world class, understand project structure, main method shortcuts, and basic elements like comments, semicolons, blocks, and white spaces.
explore java basics: using semicolons, blocks, and whitespaces; enable encapsulation with private fields, constructors, and getters/setters, and document code with javadoc.
Learn to organize Java source files with packages and import statements, declare a package, and place classes correctly, using fully qualified names or wildcard imports.
Explore Java’s primitive data types, including byte, short, int, long, float, double, char, and boolean, plus reference types and numeric formats with underscores for readability.
Learn to use the Java scanner object to read inputs with next and nextLine for strings, next for integers, and char handling via charAt(0); include import and closing the scanner.
Explore java control structures, including if else, switch case, while and do-while, and for loops. Inspect nested loops and practice break, continue, and labeled break and labeled continue statements.
Discover typecasting in Java: distinguish implicit and explicit casts, understand how byte and short arithmetic promotes to int, and learn to downcast back to byte with explicit casting.
Master Java byte type casting and wrap around, learning how values move from 127 to -128 and back, and why explicit byte casting avoids arithmetic violations.
Explore data type casting in Java, showing how integer division truncates decimals, how to cast to double to get 3.6, and how implicit casting affects char arithmetic.
Explore Java's increment and decrement operators, including pre and post increment and decrement, with practical examples using x and y to show resulting values.
Explore Java's five mathematical operators: multiplication, division, modulus, plus, and minus. Learn the order of precedence with parentheses and left-to-right evaluation, and how integer division truncates while casting yields decimals.
Explore the six Java relational operators—<, <=, >, >=, ==, !=—and how they test two values, x and y, with precedence of math before comparison, yielding true or false outcomes.
Explore how to combine relational tests using logical and short-circuit operators in Java, covering and, or, xor, not, truth tables, and short-circuit evaluation with examples.
Explore the difference between logical or and short circuit or in Java, test less than and less than equal to, and observe evaluation outcomes.
Explore the ternary operator in Java, including the test, true and false expressions, and practical examples that print pass or fail based on quiz score and passing marks.
Practice using the ternary operator in Java to determine whether an input integer is odd or even through a simple jobs program.
Create a Java class to determine if a user input number is odd or even by using modulo two, scanner input, and a ternary operator to display the result.
Learn how the assignment operator works, distinguish between = and ==, and compare longhand versus shorthand forms, including pre/post increment and plus-equals in Java.
Master how the Java if-else statement tests a condition and executes the if block or an optional else block, with practical even-odd examples using scanner input and optional braces.
Learn how to implement an if-else-if ladder in Java with an age-based decision example. Prompt for age and print: child (12 or below), teenager (13–19), adult (20–59), 60 or above.
Implement an age category classifier in Java using a chained if-else structure to output child, teenager, adult, or senior.
Build a Java program that asks for a character and classifies it as a vowel, consonant, number, or symbol using a nested if else and Character.isLetter and Character.isDigit.
Explore how the switch-case statement tests for equality, uses unique case constants, and the optional default, with Java type restrictions and the impact of break versus fall-through on code flow.
Create a java program that reads an integer representing a month and outputs the corresponding month name; for example, input 6 yields June.
Create a Java program that reads a month number via scanner, uses a switch with twelve cases to print the month name, and handles invalid inputs with a default case.
Develop a Java program that reads distance, calculates taxi fare with a 2.60 base for the first 2 km plus 1.75 per extra kilometer, max 10 km, and formats output.
Develop a Java program that reads distance (1–10 km), uses a base fare of 2.6 and adds 1.75 per km with a switch, and prints the total to two decimals.
Examine while and do-while loops in Java, showing condition-checked versus post-check execution, using a controlled counter to print 1 to 5 and clarifying curly braces and semicolons.
Explore the difference between while loops and do-while loops in Java, showing how condition checks at the top versus after execution, ensuring the loop runs at least once.
Understand infinite loops in Java, how they occur, and how to stop or prevent them in IDEs or terminals. See simple examples showing a looping condition and safe termination.
Develop a Java program that passes two numbers, assumes the first is smaller than the second, and prints all numbers from the first to the second, per the sample IO.
learn to read two numbers with a scanner, identify the smaller and larger, and print all numbers from the smaller to the larger using a while loop in Java.
learn to use the for loop in java, including initialization, condition, and update expressions; print 1 to 10, adjust increments, and explain loop variable scope and the final value.
Explore how for loops can create infinite loops in Java, with optional expressions and semicolon syntax, and see simple examples that run forever.
Write a for loop to print odd numbers from 1 to 10: 1, 3, 5, 7, 9. Then reverse the output to 9, 7, 5, 3, 1.
Print odd numbers from 1 to 10 using a for loop and an if condition; also print odd numbers from 10 to 1 using a reverse loop.
Learn how nested loops work in Java with an outer loop and an inner loop that prints i and j values, illustrating the execution flow.
Write a Java program that prints a 5 by 5 multiplication table and matches the expected output, then try it yourself before checking the solution and moving on.
Write a Java main method using nested for loops to print a 5 by 5 multiplication table, with i and j from 1 to 5 and results separated by tabs.
Explore how the break and continue statements control loop flow in Java, showing break exits loops or switch and continue skips iterations within for, while, and do-while.
master labeled breaks and labeled continues in Java to control nested loops, including breaking out of the outer loop and continuing the inner loop.
Explore the difference between primitive and reference data types, and learn how reference variables hold object addresses while objects reside in memory. See how assignment and garbage collection affect references.
Create and use a user defined class in Java by encapsulating fields, implementing a constructor, and managing object references to demonstrate how objects and memory addresses interact.
Learn how to assign reference values in Java by matching the object's type to the variable's data type. Avoid incompatible assignments like a person object to a string.
Explore how Java passes by value in methods, comparing primitive types and object references, and explain local variable scope, object references, and garbage collection.
Explore how string comparison works in Java by examining two hello strings, their identical objects, and whether a simple if condition reports them as the same.
Explore how to compare strings by content using the equals method instead of the double equals, and why reference values require equals for content comparison in Java.
Learn how the this keyword resolves ambiguity between instance variables and parameters, passes the current object to methods or constructors, and calls another constructor within the same class with this(...).
Demonstrates how the this keyword passes the current object to constructors and methods, illustrating how object references flow between age and new person calls.
Explore arrays and elements, including initialization and operations, with the enhanced for loop; accept command line arguments via string args in main, and cover two-dimensional arrays, strings and string builder.
Learn how to declare and instantiate arrays in Java, treat arrays as objects, use new for creation, and access or set elements by zero-based indices, then print their values.
learn how to create, initialize, and print arrays in java, including declaring and instantiating arrays and using inline initialization with curly braces for multiple values.
Explore how Java array declarations work and how the .length attribute drives flexible for loops. Learn to adapt loops to array size and avoid rewriting when elements change.
Implement a Java program that reads ten integers using a scanner and a for loop, and displays inputted numbers, even numbers, and negative numbers in a single Java source file.
Learn how the enhanced for loop (for-each) simplifies iterating arrays and collections in Java, its two-expression syntax, its limitations for reverse traversal and index access, with practical examples.
Copy arrays in Java with System.arraycopy to create duplicate contents, preserving immutability of the original; then dereference to allow garbage collection and observe separate memory references.
Learn how to use command line arguments in Java, passing values with string[] args, printing results, and converting inputs with parseXxx methods while looping for any number of arguments.
Explore two dimensional arrays in Java, explained as an array of arrays with rows and columns, including declare, instantiate, initialize with values, and traversing with nested loops.
Create a Java program that accepts two integer values from user input and uses them to generate and display a multiplication table.
Generate a dynamic 12 by 12 multiplication table in java by reading two integer arguments from the command line, using nested loops and a two-dimensional array, and printing tab-separated grid.
Learn how Java supports non rectangular two dimensional arrays by declaring the first dimension and leaving the second undefined, creating three single dimensional arrays of different lengths.
Model a calendar as a non rectangular structure with months of 28/29/30/31 days and leap year logic. Initialize the year and display each month's days in Java.
Develop a Java calendar solution by testing leap years (divisible by four) and assigning 28 or 29 days for February, 30 days for certain months, and 31 for others. Populate a non-rectangular calendar using a 2D array indexed by zero-based months and days, and print aligned output.
Explore the differences between strings, string buffer, and string builder in Java, including immutability versus mutability, memory references, and common operations like substring, equals, and trim.
Explore common methods of string buffer and string builder in Java, including append, delete, insert, and reverse, with practical examples and printing results.
Practice a Java program that accepts a value from the command line to check whether the string is a palindrome by reversing it and comparing characters, using the string object.
Retrieve a command line string, reverse it with a string buffer, compare to the original to determine if it's a palindrome, and test with examples like racecar and radar.
Explore inheritance and polymorphism in Java, including single inheritance, extends, superclass and subclass relationships, ER relationship, and examples with get details and get department.
Explore Java access modifiers including private, default, protected, and public, and learn how top-level classes and members are restricted by class, package, subclass, or global access.
Explore method overriding in Java, single inheritance rule, and how inherited methods can be customized to include subclass details like department while obeying name, argument, access, and return type rules.
Harness the super keyword eliminate redundancy by delegating to superclass methods and accessing inherited attributes. See how super enables get details across employee, manager, and director as we approach polymorphism.
Explore polymorphism in Java by using an employee reference to point to employee, manager, or director objects, illustrating superclass–subclass relationships and the er pattern.
Explore polymorphism and virtual method invocation on a heterogeneous array of employees, where getDetails is overridden to return name and salary, with directors adding department and car allowance.
Explore polymorphic arguments, the instance of operator, and casting in Java, showing how an animal reference can be a mammal or bird and access methods lay eggs and build nest.
Explore how the instance of operator handles polymorphic arguments across a simple employee hierarchy, using director, manager, and employee, and learn the correct reverse sequence of type checks.
Explore method overloading in Java, using the same method name with different parameter lists, and learn how varargs handles any number of arguments.
Explore inheritance and constructors in Java, showing how this and super invoke constructors across A, B, and C, while Object is the root of all classes.
Explore the object class as the root of all classes and how the equals method behaves; override equals to compare name and age and prepare for hash code.
Override hashCode whenever you override equals, ensuring equal objects share the same hash code by using the same fields (name and age) and their string hash codes.
learn how to override the toString() method in the object class to provide a readable string representation, like name and age, instead of the default memory address output.
We explain how the static keyword in Java applies to methods and variables, how static members are shared across all instances, and how to access them via the class name.
Discover accessing static members via the class name, using static imports, and comparing min and max values for byte, short, int, and long, with guidance on import ambiguity.
Explore other class features in Java and cover the final keyword, interfaces, and default interfaces. Learn to implement multiple interfaces, use static methods on interfaces, and apply the lambda operator.
Explore wrapper classes in java.lang, their relation to primitive types, and how boxing and unboxing enable seamless use as objects, including auto boxing and nullability.
Explore the Java final keyword applied to classes, methods, and variables; prevent subclassing and overriding, define constants, and declare blank final variables that must be initialized in a constructor.
Explore the enum keyword in Java to create a set of constants, with descriptive values and access, whether inside or outside a class, using days and months as examples.
Learn how the abstract keyword in Java designates classes and methods (not variables) without concrete bodies, forces subclasses to override abstract methods, and prevents instantiation of abstract classes.
Explain how Java interfaces define a contract, require implementing classes to override methods, use implements, and declare constants, illustrated by account, savings, and checking examples.
Java eight default interface methods let updating interfaces without breaking implementing classes by adding a default method, such as interest rate, to an account interface.
Examine interface static methods in Java 8, which provide static bodies inside interfaces and are invoked via the interface name to boost scalability, as shown by a bank welcome example.
Explore functional interfaces and the lambda operator in Java 8, learning how a functional interface with a single abstract method enables concise lambda expressions, default methods, and runnable patterns.
Explore the concepts of exceptions and assertions in Java, including exception objects and the try–finally blocks, plus declaration keywords and assert usage.
Explore Java errors and exceptions, explain catchable versus serious errors, and implement handling to notify users, save progress during crashes, and exit gracefully.
Learn how to use try and catch blocks in Java to handle exceptions, prevent stack traces, and gracefully validate inputs with practical examples.
Explore how the finally block guarantees cleanup by closing resources like database connections, regardless of exceptions or returns, and see its interaction with try, catch, and loops.
Explore the Java exception hierarchy, distinguishing checked and unchecked exceptions, and learn to design a single try block with multiple catches following the most specific to most general order.
Explore how java seven introduces multi catch to reduce redundancy when multiple exceptions share the same handling, replacing two catches with a single catch that logs the problem.
Demonstrate the parameterized try block and the handle-or-declare rule by handling input and comparing try-catch with throws.
In Java 7, use a parameterized try-with-resources block to manage closable resources without a catch or finally block. Resources inside the parentheses must implement AutoCloseable, like BufferedReader, enabling automatic closing.
Explore the throws keyword for declaring exceptions, showing how a method can declare a single or multiple exception types by listing them separated by commas.
Learn the rules for overriding methods and exceptions in Java, including when to declare throws and how subclass and superclass relationships affect allowed exceptions.
Create your own exceptions by extending the exception class for checked errors or the runtime exception for unchecked errors, using throw and catch in a bad tasting food exception example.
Use assertion checks with the assert keyword to validate boolean expressions and trigger assertion errors when false, with assertions enabled at runtime (default off in Java 8+).
Java is one of the most prominent programming languages today due its power and versatility.
Our concept at LearningWhilePracticing is to guide you to be operational right away. We help you uncover new skills through practice, instead of going over a boring class where you would not be grasping the concepts. Practices makes perfect!
In this course, you will be guided by Oracle certified Java expert Mr Lawrence Decamora, from start to finish.
NO JAVA KNOWLEDGE IS PREVIOUSLY REQUIRED!
This Java tutorial is made up of 14 sections:
Section 0: Setting up your Java Development Kit
Downloading, Installing and Configuring your JDK
Windows OS
Mac OS
Setting up your IDE
Eclipse
NetBeans
Section 1: Your First Java Cup
How to write your first Java Program --> HelloWorld.java
How to save, compile and run your first Java Program
How to debug a compilation error
The Parts of your Java Program
class
the main method
the System.out.println() method
the (+) operator
the '\n' and '\t' characters
Commonly encountered errors:
Misspelled public class name vs misspelled filename
Misspelled keywords and method names
Incorrect location of your file or your present working directory.
Section 2: Difference between a Class and an Object
How to create an object
Constructors
instance variables
instance methods
How to use / test an object.
Encapsulation (Data Hiding)
Java API Documentation
The import Statement
Section 3: Introducing the use of an Integrated Development Environment (IDE)
Eclipse
Netbeans
IntelliJ
Creating our first Netbeans Project
Comments in Java
single line comments
multi line comments
java doc comments
The Semi-colon;
The { } blocks
Whitespaces
The import Statement
The package Statement
Java Data Types
Reference Data Types (To be discussed in Section 5)
Primitive Data Types
byte
short
int
long
float
double
char
boolean
The Scanner object.
The nextXxx() methods
Section 4: Operators and Control Structures
Operators
Casting
Increment / Decrement (++ / --)
Mathematical (*, /, %, +, -)
Relational (<, <=, >, >=, ==, !=)
Logical Operators (&, |, ^)
Short-Circuit Operators (&&, ||)
Ternary Operators (? :)
Assignment and Short-Hand Operators
Control Structures
if-else
switch-case
while
do while
for loop
nested loops
break and continue statements
labeled break and labeled continue statements
Section 5: The Reference Data Types
Primitive Data Types vs Reference Data Type
User Defined Classes --> Reference Data Types
Assigning References to Variables
Pass by Value and Local Variable Scopes
The this Reference
Section 6: Arrays and Strings
Array Creation and Initialization
Array Limits (.length)
The Enhanced for loop
Copying Arrays
Command-Line Arguments
The parse Methods
Array of Arrays (Two-dimensional Arrays)
Non-Rectangular Arrays
String, StringBuffer and StringBuilder
Section 7: Inheritance and Polymorphism
Inheritance: Classes, Superclasses, and Subclasses
Single Inheritance
The ”is-a” relationship
Java Access Modifiers
Method Overriding
Rules in Overriding a Method
The super keyword
Polymorphism
Virtual Method Invocation and Heterogeneous Array
Polymorphic Arguments
The instanceof operator
Casting of Objects
Overloading Methods
Rules for Method Overloading
Inheritance and Constructors
Overloading Constructors
The Object class (equals(), hashCode() and toString() methods)
The static keyword
How do we access / call a static variable or a static method?
The Math and System Classes
The static imports
Section 8: Other Class Features
The Wrapper Classes
The final keyword
The enum keyword
The abstract keyword
Java Interfaces
The Interface default methods
The Interface static methods
The Functional Interface and the Lambda (->) Operator
Section 9: Exceptions and Assertions
The Exception and The Error class
Why do we need to have Exception Handling?
Sample Exceptions
Java’s Approach, the Call Stack Mechanism
The five keywords used for Exception handling or Exception declaration
General Syntax of an exception - handling block
The try – catch block
The finally block
The Exception Hierarchy in Java
Multiple Exceptions in a catch Block
The parameterized try block
The Handle-or-Declare rule
The throws keyword
Rules on Overriding Methods and Exceptions
Creating your own Exception objects
Assertion Checks
Section 10: IO and FileIO
How to accept inputs using:
The Scanner Class
The BufferedReader and InputStreamReader Classes
How to format an output.
The File class.
How to read and write inputs from and to a File.
Section 11: The Collection and Generics Framework
The Collection Interface
The Set Interface
The List Interface
The Map Interface
The Iterator Interface
The Generics Framework
Creating your own Set of Collection objects
Sorting your Collection
Section 12: Building a GUI Based Desktop Application
The AWT package
Components, Containers, and Layout Managers.
Using selected layout managers to achieve desired GUI layout.
Add components to a containers
Demonstrate how complex layout manager and nested layout managers works.
Define what events, event sources, and event handlers are.
Event handling techniques
Write code to handle events that occur in a GUI
Describe the five (5) ways on how to implement event handling technique.
Converting the AWT code to a Swing application
Packaging a JAR file for application deployment
Section 13: Introduction to JDBC
– Introduction to Database Concepts
– How to Create your first DB Schema
- Basic SQL Statements
- SELECT
- UPDATE
- DELETE
- INSERT
- What is JDBC?
- The Statement Interface
- The PreparedStatement Interface
Each section contains its ressources files (codes and notes used by the instructor)
Whether you're a complete beginner or already got knowledge in Java, this course is for you! Happy Coding!