Java tutorial
Java is taught in most IT and computer science programs. These lessons explain each line so the rules make sense, not just the syntax.
Lessons
- 1Introduction to Java: History, Features, JDK, and JVMWhat Java is, where it came from, how it differs from C, and how the JDK, compiler, and JVM turn your code into a running program.7 min3 practice items
- 2Java Program Structure and Syntax: Your First Program Line by LineUnderstand every line of a first Java program: classes, main, statements, comments, identifiers, keywords, and the three kinds of errors.8 min4 practice items
- 3Java Variables, Constants, and Data TypesDeclare and initialize Java variables, pick the right primitive or reference type, use final constants, understand scope, and convert between types with casting.8 min3 practice items
- 4Java Input and Output: println, printf, Escape Sequences, and ScannerPrint neat output in Java with print, println, and printf, use escape sequences, and read keyboard input with the Scanner class, including the nextLine trap.8 min3 practice items
- 5Java Operators and Expressions: Arithmetic, Logical, Increment, and PrecedenceUse Java's arithmetic, assignment, relational, logical, and unary operators, understand ++ and --, and predict results using operator precedence.8 min3 practice items
- 6Java Selection Structures: if, else if, Nested if, and switchMake decisions in Java with if, if-else, else-if ladders, nested if, and switch, and learn to compare Strings correctly with equals().7 min2 practice items
- 7Java Loops: for, while, do-while, Nested Loops, break, and continueRepeat code in Java with for, while, and do-while loops, build patterns with nested loops, and control loops with break and continue.8 min3 practice items
- 8Java Arrays and Methods: 1D and 2D Arrays, Searching, Parameters, and Return ValuesStore many values in Java arrays, loop through 1D and 2D arrays, search them, and organize code into methods with parameters, return values, and overloading.10 min2 practice items
- 9Introduction to Object-Oriented Programming in JavaProcedural vs object-oriented programming, why OOP helps, how objects combine attributes and behaviors, and a first look at the four pillars of OOP.7 min3 practice items
- 10Java Classes and Objects: Fields, Methods, and Object ReferencesDeclare a Java class, create objects with new, use fields and instance methods, understand object references and null, and make many objects from one class.8 min2 practice items
- 11Java Constructors: Default, Parameterized, Overloading, and the this KeywordUse Java constructors to set up objects when they're created: default and no-argument constructors, parameterized constructors, overloading, and this.8 min2 practice items
- 12Java Encapsulation: private Fields, Access Modifiers, Getters, and SettersProtect an object's data in Java with private fields, the four access levels, getter and setter methods, and validation that keeps every object valid.7 min2 practice items
- 13Java Method Overloading and Object Interaction: Signatures, Composition, and RelationshipsOverload Java methods correctly using signatures, pass objects to methods, have objects call each other, and build classes from other classes with composition.10 min3 practice items
- 14Database Basics for Java Developers: Tables, Keys, MySQL Data Types, and WorkbenchLearn why applications store data in a database, how tables, rows, and columns work, which MySQL data types to choose, and how primary and foreign keys link tables.12 min4 practice items
- 15Essential SQL for Java Applications: CREATE, INSERT, SELECT, UPDATE, and DELETEWrite the SQL every database application needs: create a database and tables, insert rows, query them with WHERE and ORDER BY, and safely update and delete data.15 min6 practice items
- 16Designing a Project Database in MySQL: Tables, Keys, Sample Data, and CRUD PracticeDesign a Student Information Program database step by step: tables, column types, and keys, sample data, CRUD and JOIN practice, and getting ready for JDBC.23 min5 practice items
- 17Java Inheritance, Polymorphism, Abstract Classes, and InterfacesReuse code with extends and super, override methods, use compile-time and runtime polymorphism with up- and downcasting, and design with abstract classes and interfaces.18 min4 practice items
- 18Java Exception Handling and Collections: try-catch, throw, ArrayList, and HashMapHandle errors in Java with try, catch, finally, throw, and throws, learn the common exceptions, and store objects in a growable ArrayList and a HashMap.17 min3 practice items
More Java lessons are being written and will appear here in order.