d great one
Apprentice
- Joined
- Nov 4, 2007
- Sythe Gold
- 0
- Messages
- 930
This is my main program. Everything is fine before calling the method.
This is the main problem. I don't know how to put mathematical operation in an array.
The method should sort the input integers.
In example, if I input 5, 8, 9, 4,6 the method will sort all the integers and display the lowest first then to the highest integer.
Need help please. Thanks!
//this is the main class
import java.io.*;
class mainko{
public static void main(String args[])throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int[] number=new int[5];
for(int x=0;x<5;x++){
System.out.println("Enter 5 integers: ");
number[x]=Integer.parseInt(br.readLine());
}
System.out.print("Number in array are: ");
for(int x=0;x<5;x++){
System.out.println(number[x]+" ");
}
sorting prog=new sorting();
prog.sort(number);//need help calling the method
}
}
This is the main problem. I don't know how to put mathematical operation in an array.
The method should sort the input integers.
In example, if I input 5, 8, 9, 4,6 the method will sort all the integers and display the lowest first then to the highest integer.
//problem lies in creating the method here
class sorting{
public void sort(){
int[] array=new int[5];
}
}
Need help please. Thanks!


