hi..
I am writing the code for selection sort, you'll need to pass the numbers for sorting as command line arguments that is along with the command you use to run the java program
e.g., java Selection 12,45,1,76,50
the code is as follows:
class Selection
{
public static void main(String arg[])
{
int x[]; //declaring an empty array,initialized later
int i;
//checking if arguments have been given or not at the command line
if(arg.length==0)
System.out.println("No Arguments Specified...\n");//prints msg if no args specified
else
{
x=new int[arg.lenght]; //initializing the array with the no. of args specified.
try //trapping any errors that might occur
{
for(i=0;i
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
hai..pwedi nyo b akong bgyan ng isang code about selection sort....thanks
Start a new thread and write proper english
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
can you gave us a running program about selection sort that the user will input something from the keyboard...thank you...
NO.
Start a new thread. There are plenty of examples on how to read input with the Scanner class. Start a new thread with some code.
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448