Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;

public class Main {

    public static void main(String[] args) {

        // intializing an array arr1
        short[] arr1 = new short[] { 15, 10, 45 };

        System.out.println(Arrays.toString(arr1));

        // copying array arr1 to arr2 with range of index from 1 to 3
        short[] arr2 = Arrays.copyOfRange(arr1, 1, 3);

        System.out.println(Arrays.toString(arr2));
    }
}