mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-06 06:47:54 +02:00
new boolean[] not really required when initializing.
Introducing this disrupts the flow a little bit to think, if specifying `new boolean[] ` required when intializing.
This commit is contained in:
@@ -175,7 +175,7 @@ public class LearnJava {
|
|||||||
// Another way to declare & initialize an array
|
// Another way to declare & initialize an array
|
||||||
int[] y = {9000, 1000, 1337};
|
int[] y = {9000, 1000, 1337};
|
||||||
String names[] = {"Bob", "John", "Fred", "Juan Pedro"};
|
String names[] = {"Bob", "John", "Fred", "Juan Pedro"};
|
||||||
boolean bools[] = new boolean[] {true, false, false};
|
boolean bools[] = {true, false, false};
|
||||||
|
|
||||||
// Indexing an array - Accessing an element
|
// Indexing an array - Accessing an element
|
||||||
System.out.println("intArray @ 0: " + intArray[0]);
|
System.out.println("intArray @ 0: " + intArray[0]);
|
||||||
|
Reference in New Issue
Block a user