我有个问题 。我正在学习 java,这个示例代码不起作用,说:
$javac Quicksort.java 2>&1
Quicksort.java:16: error: constructor Quicksort in class Quicksort cannot be applied to given types;
Quicksort qc = new Quicksort(values);
^
required: no arguments
found: int[]
reason: actual and formal argument lists differ in length
1 error
无法弄清楚为什么。谁能帮忙??
我的代码片段是:
public class Quicksort{
public int[] number ;
public void Quicksort(int[] values){
this.number=values;
}
public void print(){
for (int i=0; i<number.length;i++)
System.out.println(number[i]);
}
public static void main(String[] args){
int[] values = {3,4,5,6,7,8};
Quicksort qc = new Quicksort(values);
qc.print();
}
}