From your first output to streams and generics: these articles take you through the Java basics in a sensible order, the way school, vocational training and first-year courses teach them.
- Input and outputJava input and output explained simply: print values with println and printf, read numbers with Scanner. With examples and common mistakes.Read article
- ConditionsJava conditions with if, else if, switch, && and || explained clearly. With examples and the common mistakes that cost points in exams.Read article
- LoopsJava loops explained simply: for, while, do-while, break and continue with examples. Plus the common mistakes that cost points in exams.Read article
- ArraysJava arrays explained simply: create them, loop through them, use two-dimensional arrays. With examples and common mistakes like the wrong index.Read article
- StringsJava strings explained simply: substring, charAt, split, equals and StringBuilder with examples. Plus common mistakes like comparing with ==.Read article
- Methods and recursionJava methods explained simply: parameters, return, overloading, varargs and recursion with examples. Plus common mistakes like a missing return.Read article
- Classes and objectsJava classes and objects explained simply: fields, constructors, getters, static and records with examples. Plus common mistakes like shadowed fields.Read article
- Lists and mapsLists and maps in Java explained simply: ArrayList, HashSet and HashMap with examples. Plus common mistakes like List<int> and remove on numbers.Read article
- Inheritance and interfacesJava inheritance explained simply: extends, super, @Override, abstract classes, interfaces and Comparable with examples. Plus common mistakes.Read article
- Exceptions and enumsJava exceptions explained simply: try, catch, finally, throw, custom exceptions and enums with examples. Plus common mistakes like empty catch blocks.Read article
- Lambdas and streamsJava lambdas and streams explained simply: filter, map, reduce, Comparator and groupingBy with examples. Plus common mistakes with toList() and reversed().Read article
- Generics and modern JavaJava generics explained simply: generic classes and methods, var, instanceof, Optional and sealed with examples. Plus common mistakes like Box<int>.Read article