0
所以我看了很多其他標識符預期的答案,他們似乎並不適合。我在我的主類中有完整的代碼,但沒有在我的主要方法中。我覺得我只是想念一些簡單的東西。標識符預期錯誤(不正常的答案)
import java.util.Arrays;
import java.util.Scanner;
import java.util.Random;
public class L7C14
{
public void QuickSort(int[], int min, int max)//this is where Im getting the ID error. I placed it at the top for Q/A purposes. quick sort is just supposed to be another method in my class L7C14.
{
int middle = min + ((max-min) /2);//not finished with code logic in here
}
public static void main(String[] args)
{
Random rand = new Random();
int[] nums = new int[10];
Scanner input = new Scanner(System.in);
System.out.println("please make a selection: Would you like to input 10 numbers (1) or randomly generate them (2)");
if(input.nextInt()==1)
{
for (int i = 0; i < nums.length; i++)
{
System.out.println("Number "+(i+1)+"?");
nums[i] = input.nextInt();
}
}
else
{
for (int i = 0; i < nums.length; i++)
{
nums[i] = rand.nextInt(648);
}
}
//now the array is fully populated
//display numbers[]
System.out.println("Your numbers are");
System.out.println(Arrays.toString(nums));
/* I think this looks better
for (int i = 0; i < nums.length; i++)
{
System.out.print("\n"+nums[i]);
}
*/
}
//now sort lowest to highest, display
//sort highest to lowest, display
}
你得到的錯誤是哪一行?而且,爲什麼你將它標記爲JavaScript,當它明顯是Java? –
甚至沒有意識到。這整個問題格式不好,只是要把它拿下來,因爲我知道了。感謝您的快速回復 –