repl.it
@AlephZero/

javatest

Java

No description

fork
loading
Files
  • Main.java
  • jdt.ls-java-project
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class Main {
    public static void printRangeOfInts(int x, int y) {
    int[] a = { 1, 2, 3, 4, 5, 6, 7 };
    for (int i = a.length - x; i >= a.length - y; i--) {
            System.out.println("Value:" + a[i]);
    }
}

    public static void main(String[] args) {
        System.out.println("printRangeOfInts(2,3) should print:\nValue: 6\nValue: 5");
        System.out.println();
        System.out.println("Prints wrong:");
        printRangeOfInts(2, 3);

        System.out.println();
        System.out.println(
                "printRangeOfInts(1,7)should print:\nValue: 7\nValue: 6\nValue: 5\nValue: 4\nValue: 3\nValue: 2\nValue: 1");
        System.out.println();
        System.out.println("Prints wrong:");
        printRangeOfInts(1, 7);
        
        int x=0, y=0;
    }
}
Fetching token
?