public class test
{
public static void main (String[ ] args )
{
TheClass one = new TheClass(); constructor
TheClass two = new TheClass(str , doubleNum); // I: calling the parameter constructor to //pass: “David William” and 3.5 to the object
System.out.println( one );
System.out.println( two );
// call the method staticMethod
System.out.print(two.staticMethod());
}
}
class TheClass
{
private String str;
private static int intNum = 0;
private double doubleNum ;
public TheClass()
{
str = "unknown";
doubleNum = 0.0;
}
public TheClass (String s, double d)
{
str = s;
doubleNum = d;
}
public static void staticMethod ()
{
intNum ++;
}
}
做“System.out.println(one);”有意义吗?&“System.out.println(二);” 因为它们只是构造函数?这两条线的输出是什么?