group5.java
来自「Java基础教程课程中的例题源码下载。总共有11章」· Java 代码 · 共 40 行
JAVA
40 行
public class Group5
{
public interface Student_info //内部接口
{
public void output();
}
public class Student implements Student_info //内部类实现内部接口
{
int count;
String name;
public Student(String n1)
{
name = n1;
count++;
}
public void output() //实现接口方法
{
System.out.println(this.name +" count="+this.count);
}
}
public Group5(String name1[])
{
Student s1;
int i=0;
while (i<name1.length)
{
s1 = new Student(name1[i]);
s1.output();
i++;
}
}
public static void main (String args[])
{
Group5 g5;
if (args.length>0)
g5 = new Group5(args);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?