public class ClassDemo {
public static void main(String[] args) {
//第一个类
Test test = new Test();
test.name = "小明";
test.sex = "男";
test.show();
//测试类
TestDemo testDemo = new TestDemo();
testDemo.temp(new Test());//其实这里需要的是一个对象。
}
}
class Test {
String name;
String sex;
public void show() {
System.out.println("无参数");
}
}
//类名作为形式参数
class TestDemo {
public void temp(Test t) {
System.out.println("类名作为形式参数");
}
}