谁能帮我看一下这个程序的结果吗,然后帮我解释一下原因,谢谢!!

mxtah 2004-03-11 12:09:51
class AB
{
private int a,b=0;
void init(int x)
{
a=x;
int b=5;
System.out.println("in init:");
System.out.println("a="+a+" b="+b);
}
void showAB()
{
System.out.println("a="+a+" b="+b);
}
}
public class ABTest
{
public static void main(String args[])
{
AB ab=new AB();
System.out.println("before init:");
ab.showAB();
ab.init(6);
System.out.println("after init:");
ab.showAB();

}
}
...全文
57 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复

62,623

社区成员

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

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