Topic: 这个程序为什么不能用PRIVATE?

  Print this page

1.这个程序为什么不能用PRIVATE? Copy to clipboard
Posted by: 浪迹天
Posted on: 2006-11-03 12:09

private class chengxu {

  /**
   * @param args
   */
  public static void main(String[] args) {
    // TODO Auto-generated method stub

  }

}

2.Re:这个程序为什么不能用PRIVATE? [Re: 浪迹天] Copy to clipboard
Posted by: Skybus
Posted on: 2006-11-03 20:17

因为里面包含有main方法

3.Re:这个程序为什么不能用PRIVATE? [Re: 浪迹天] Copy to clipboard
Posted by: lisliefor
Posted on: 2006-11-07 10:54

?????

4.Re:这个程序为什么不能用PRIVATE? [Re: 浪迹天] Copy to clipboard
Posted by: zhangwensheng
Posted on: 2006-11-07 12:57

private型的方法或变量只能在所属的类内部调用
public static void main(String[] str) 是一个类的入口,被系统引用
所以必须且只能是public

5.Re:这个程序为什么不能用PRIVATE? [Re: 浪迹天] Copy to clipboard
Posted by: liushuiboy
Posted on: 2006-12-20 17:21

外部类的修饰府只能为default or public


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923