• 2022-06-07
    (6-3)阅读程序,写出程序运行结果。 class Book{ private static int counter=0; private int id=1; private String name; public Book(String name) { this.name = name; counter++; this.id=this.id+8; } public static int getCounter() { return counter; } public int getID() { return this.id; } } public class BookDemo{ public static void main(String[] args) { Book b1=new Book("红楼梦"); Book b2=new Book("西游记"); Book b3=new Book("儒林外史"); System.out.println(b3.getCounter()*Book.getCounter()*b3.getID()); } }
  • 举一反三