public class TestToString
{
/*
时代Java公众号 - nowjava.com 提 供
*/
public static void main(String[] args)
{
Employee emp = new Employee("A", "B");
System.out.println(emp.toString());
int x = 50;
String s = new Integer(x).toString();
String s1 = "" + x;
System.out.println(s);
System.out.println(s1);
}
}
class Employee
{
private String lastName;
/*来自
时 代 J a v a 公 众 号 - N o w J a v a . c o m*/
private String firstName;
public Employee(String lastName, String firstName)
{
this.lastName = lastName;
this.firstName = firstName;
}
public String toString()
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。