Multidimensional and Jagged Arrays in Java
Java has no true two dimensional array. It has arrays of arrays, which is what makes jagged shapes possible.
Notes related to the Java language.
100 notes tagged
Java has no true two dimensional array. It has arrays of arrays, which is what makes jagged shapes possible.
An array is a fixed size object holding elements of one type, indexed from zero, with the length fixed at creation.
Java always passes arguments by value. For objects the value copied is the reference, which explains every result that looks like pass by reference.
A variable arity parameter lets a method accept any number of arguments, and inside the method it is simply an array.
A recursive method calls itself on a smaller problem, and it works only when a base case guarantees the shrinking stops.
Several methods may share a name if their parameter lists differ, and the compiler decides which one runs before the program starts.
A method groups a piece of behaviour behind a name, a parameter list and a return type, and that signature is the contract callers depend on.
Every looping construct in Java, when each one fits, and how break, continue and labels change the flow.
Decision making in Java, from the plain if statement to modern switch expressions and pattern matching.
The three comment forms, the reserved words you cannot use as names, and the naming conventions every Java codebase follows.
Reading from the keyboard and writing to the console, with the Scanner pitfall that catches almost every beginner.
Java operators grouped by purpose, with the precedence rules, short circuit behaviour and integer arithmetic surprises that trip people up.