【265天】我爱刷题系列(24)

叨叨两句

  1. 如今个人心理调节能力真是强悍啊,看了那么多书和文章,果真是有用的。
  2. 有好朋友的感受真好!哈哈!

牛客网——java专项练习004

1

Test.main() 函数执行后的输出是(D)


A. 11 17 34
B. 22 74 74
C. 6 7 7
D. 22 34 17java

大神解析函数

2

以下代码的输出结果是什么?(编译错误)spa

public class Test {
    public int aMethod(){
        static int i = 0;
        i++;
        return i;
    }
public static void main(String args[]){
    Test test = new Test();
    test.aMethod();
    int j = test.aMethod();
    System.out.println(j);
    }
}
Java中静态变量只能在类主体中定义,不能在方法中定义。 静态变量属于类全部而不属于方法。
相关文章
相关标签/搜索