About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Monday, April 26, 2010

JAVA(Sorting The Array)-------------------

//Sorting the Array


import java.io.*;

import java.util.*;

class DemoArray

{

public static void main(String aa[])throws Exception

{

int arr[]=new int[10];

DataInputStream dis=new DataInputStream(System.in);

System.out.println("Enter 10 elements in Array..");

for(int i=0;i<10;i++)

{

arr[i]=Integer.parseInt(dis.readLine());

}

System.out.println("Entered 10 elements in Array ....");

for(int i=0;i<10;i++)

{

System.out.print(" "+arr[i]);

}

Arrays.sort(arr);

System.out.println("");

System.out.println("Sorted 10 elements in Array ....");

for(int i=0;i<10;i++)

{

System.out.print(" "+arr[i]);

}





}

}

No comments: