三个问题!谢谢!
问题一:
class shape{}//每个继承类及基础类里都有方法draw,为了方便我没写出来
class circle extends shape{}
class square extends shape{}
class triangle extends shape{}
public class shapes{
public static shape randshape(int i){//问题就在这里,错误提示这里不能返回类型shape
switch(i%3){
default:
case 0:return circle;
case 1:return square;
case 2:return triangle;
}
}
public static void main(String args[]){
shape[] s=new shape();
for(int i=0;i<s.length;i++)
s[i]=randshape[i];
for(int k=0;k<s.length;i++)
s[i].draw();
}
}
问题二:
我在Jbuilder里写了如下程序
package quick
public class p{
public static void rint(String s){
System.out.print(s);
}
}
另一个程序为
import quick.*;
public test{
public static void main(String args[]){
p.rint("test");
}
}
这样错在哪里?如何改?路径又怎样设置!
另外jpx jar 是什么意思???