public class PrintTest
{
public String str1 = "ball";
public String str2 = "basketball";
public String str3 = "itcast";
//重写toString()方法
public String toString()
{
return str1 +":"+str2+":"+str3;
}
}
public class PrintDemo
{
public static void main(String[] args)
{
PrintTest pt = new PrintTest();