标题:初学者求大神解答!程序和 err 如下。
取消只看楼主
ilearn
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2014-9-13
结帖率:100%
已结贴  问题点数:20 回复次数:0 
初学者求大神解答!程序和 err 如下。
class Variable
{
    int x=0,y=0,z=0;  //类的成员变量
    void init(int x,int y)
    {
        this.x=x;
        this.y=y;
        int z=5;     //局部变量
        System.out.println("****in init****");
        System.out.println("x="+x+"  y="+y+"  z="+z);
    }

public class VariableTest
{
    public static void main(String args[])
    {
        Variable v=new Variable();
        System.out.println("****before init****");
        System.out.println("x="+v.x+"  y="+v.y+"  z="+v.z);
        v.init(20,30);
        System.out.println("****after init****");
        System.out.println("x="+v.x+"  y="+v.y+"  z="+v.z);
    }
}

--------------------Configuration: <Default>--------------------
D:\JAVA\package\VariableTest.java:13: 错误: 需要class, interface或enum
}?
 ^
1 个错误

Process completed.



--------------------Configuration: <Default>--------------------
错误: 找不到或无法加载主类 VariableTest

Process completed.
搜索更多相关主题的帖子: public before 
2014-11-24 22:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-439113-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.220374 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved