JAVA

Switch Usage in Java

Use the switch statement to select one of many code blocks to be executed. 1// syntax …

Multidimensional Arrays …

A Multi-Dimensional array is an array of arrays. 1// Three dimensional string array 2String[][][] …

Foreach Loop Usage in …

1// syntax 2for (type variablename : arrayname) { 3 // code block 4} 5 6String[] carBrands = …

If Else Usage in Java

NOTE a == b # Equals a != b # Not Equals a > b # Greater than a < b # Less than a >= b # …

For Loop Usage in Java

1// syntax 2for (statement 1; statement 2; statement 3) { 3 // code block 4} 5 6// starts 0, …

While Loop Usage in Java

if while condition is true, it continues to run. 1int x = 0 2while (x < 2) { 3 …

Array Usage in Java

1int[] numeric = {1, 2, 3, 4}; 2String[] carBrands = {"audi", "bmw", …

How to Find List Size in …

1// usage: 2int size = list.size() 3 4// string example 5List<String> list = …

How to Find Array Length …

1// usage: 2int len = array.length 3 4int[] arr = new int[5]; 5System.out.println("array length …

How to Add Comments in …

1// usage: 2int size = list.size() 3 4// string example 5List<String> list = …