Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions 14 - Arrays/src/App.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
public class App {
public static void main(String[] args) {

int value = 7;

int[] values;
values = new int[3];

System.out.println(values[0]);

// array values contains 10,20,30

values[0] = 10;
values[1] = 20;
values[2] = 30;

// print the values of the array values
System.out.println("values present in array values are as follow:");
System.out.println(values[0]);
System.out.println(values[1]);
System.out.println(values[2]);

System.out.println("values present in array values using for loop are as follow:");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a repetition of the below code?

 System.out.println("values present in array values using for loop are as follow:");
        for(int i=0; i < values.length; i++) {
            System.out.println(values[i]);
        }

for(int i=0; i < values.length; i++) {
System.out.println(values[i]);
}

int[] numbers = {5, 6, 7};

System.out.println("values present in array numbers are as follow:");
for(int i=0; i < numbers.length; i++) {
System.out.println(numbers[i]);
}
}

}
}