三个问题!谢谢!

taciya taciya 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
问题一:
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 是什么意思???

...全文
评论 1
收藏 已收藏
分享
返回顶部
taciya
非技术区 23,404 成员 70,506 内容