1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
/* Compare Two Java short Arrays Example This java example shows how to compare two short arrays for equality using Arrays.equals method. */ import java.util.Arrays; public class CompareShortArraysExample { public static void main(String[] args) { //create short arrays short[] shortArray1 = new short[]{107,93,58}; short[] shortArray2 = new short[]{107,93,58}; /* To compare two short arrays use, static boolean equals(short array1[], short array2[]) method of Arrays class. It returns true if both arrays are equal. Arrays are considered as equal if they contain same elements in same order. */ boolean blnResult = Arrays.equals(shortArray1,shortArray2); System.out.println("Are two short arrays equal ? : " + blnResult); /* Please note that two short array references pointing to null are considered as equal. */ } } /* Output of the program would be Are two short arrays equal ? : true */ |
I want to learn more about creating java program.
help1!
WILL ACCEPT
INPUT OF 9 different whole numbers, then display which from the accepted
input is the highest and the lowest and identify the order if its
entered first second or the last.
FILENAME: MP_mid1