public class Person {String name;public void person(String personName) {name = personName;}public String greet(String yourName) {return String.format("Hi %s, my name is %s", name, yourName);}}
1 回答
富国沪深
TA贡献1790条经验 获得超9个赞
public class Person { String name; public void person(String personName) { name = personName; } public String greet(String yourName) { return String.format( "Hi %s, my name is %s" , name, yourName); } public static void main(String[] args) { Person p = new Person(); p.person( "haha" ); System.out.println(p.greet( "hehe" )); } } |
添加回答
举报
0/150
提交
取消