📄 group6.java
字号:
public class Group6
{
public static class Student //定义静态公用内部类
{
static int count; //静态内部类中的静态变量
String name;
int number; //序号
public Student(String n1) //静态内部类的构造方法
{
name = n1;
count++;
number = count; //序号自动增加
}
public void output()
{
System.out.println(this.name +" number="+this.number);
}
}
public static void main (String args[])
{
Group6.Student s1 = new Group6.Student("A");
s1.output();
Group6.Student s2 = new Group6.Student("B");
s2.output();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -