MCPcopy Create free account
hub / github.com/Manvityagi/PW-Skills-Java-Course-Codes / App

Class App

Lecture 15 Arrays/src/App.java:1–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1public class App {
2
3 static void printArray(int[] arr){
4 for(int i = 0; i < arr.length; i++){
5 System.out.print(arr[i] + " ");
6 }
7 System.out.println();
8 }
9 static void changeArray(int[] arr){
10 for(int i = 0; i < arr.length; i++){
11 arr[i] = 0;
12 }
13 }
14
15 static void changeVal(int a){
16 a = 1004;
17 }
18
19 public static void main(String[] args) {
20 int a = 5;
21 changeVal(a);
22 System.out.println(a); // 5
23
24 int[] arr = new int[3];
25 arr[0] = 5;
26 arr[1] = 8;
27 arr[2] = 7;
28
29 changeArray(arr);
30 printArray(arr);
31
32 boolean ans = true;
33 for (int i = 1; i < arr.length; i++){
34 if(arr[i] < arr[i-1]){
35 ans = false;
36 }
37 }
38 System.out.println(ans);
39 }
40}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected