能否告之并且解释一下运行结果?

MatrixCpp 2004-02-24 03:58:42
public class parcell{
class contents{
private int i=11;
public int value(){return i;}
contents(){
System.out.println(value());
}
}
class destination{
private String label;
destination(String whereTo){
label=whereTo;
System.out.println(label);
}
String readLabel(){ return label;}
}

public void ship(String dest){
contents c=new contents();
destination d=new destination(dest);
System.out.println(d.readLabel());
}
public contents getcontents(){
return new contents();
}
public destination getdestination(String s){
return new destination(s);
}

public static void main(String[] args){
parcell p=new parcell();
p.ship("good morning!");
parcell q=new parcell();

parcell.contents c=q.getcontents();
parcell.destination d=q.getdestination("good afternoon!");
}
}
...全文
54 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复

62,635

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧