public class Person { String name; int age; public void display(){ System.out.println("name:"+name+"age"+age); } Person(String n,int a){ name=n; age=a; } } public class Test{ public static void main(String[] args) { Person p=new Person("小花儿", 8); p.display(); } }
时间: 2025-01-21 20:22:30