Array is mainly significant thing in any programming language. Array is a fixed memory allocation and this will assign the memory for same data type sequence. Array contains multiple values of same types and this all values are set memory at same size. Multiple type of array used in all programming language such as one - dimensional, two - dimensional or can say multi - dimensional.
Declaration of an array:
int new[]; or int new= new int[2]; or int num[] = {5,2,4,8,7,6};
Here is the code of the program:
Code:
import java.util.*;
public class array{
public static void main(String[] args){
int new[] = {50,20,45,82,25,63};
int a = new.length;
int w,b,y;
System.out.print("Given number : ");
for (w = 0;w < a;w++ ){
System.out.print(" " + num[w]);
}
System.out.println("\n");
System.out.print("Accending order number : ");
Arrays.sort(num);
for(w = 0;w < a;w++){
System.out.print(" " + num[w]);
}
}
}
Bookmarks