static静态属性--面试题

来源:互联网 发布:网络剧备案号 编辑:程序博客网 时间:2024/05/16 17:24

public class Book {
static Book book = new Book();//1
static int a;//2
static int b=0;//3

private Book() {//4    a++;    b++;}public static void main(String[] args) {    Book book = new Book();    System.out.println(book.a);    System.out.println(book.b);}

}

原创粉丝点击