public class Test2{
来源:百度知道 编辑:UC知道 时间:2024/06/20 18:56:25
public class Test2{
public static int aMethod() {
static int i = 0;
return i;
}
public static void main(String[] args) {
static Test2 test = new Test2();
test.aMethod();
int j = test.aMethod();
System.out.println(j);
}
}
有什么错
public static int aMethod() {
static int i = 0;
return i;
}
public static void main(String[] args) {
static Test2 test = new Test2();
test.aMethod();
int j = test.aMethod();
System.out.println(j);
}
}
有什么错
静态方法中只能使用静态变量
静态方法中声明的变量就是静态变量,无需加static关键字
变量前面的 static 去掉
public class Test2 {
public static int aMethod() {
int i = 0;
return i;
}
public static void main(String[] args) {
Test2 test = new Test2();
test.aMethod();
int j = test.aMethod();
System.out.println(j);
}
}
public class
public class SomethinglsWrong
public class Exercise0301
关于 public: static class
public class A
class CAboutDlg : public CDialog是什么意思
public class的用法及作用是什么?
C#中public class 和 class 的区别是什么?
public abstract class AbstractPainter<T extends JComponent> extends JavaBean implements Painter<T>
class中的成员默认是private,而struct的成员默认为public。