JAVA初学者,请问以下程序中特定字符串何时被输出
请问“Hi there”何时被输出,还有负责输出这个字符串的static方法到底算什么?构造方法么?如果不是构造方法为什么可以不写方法名
程序代码:public class B
{
int x;
int y;
static
{
System.out.println("Hi there");
}
public void print()
{
System.out.println("Hello");
}
public static void main(String args[])
{
B st1=new B();
st1.print();
B st2=new B();
st2.print();
}
}[ 本帖最后由 绯苍幻想曲 于 2011-6-28 16:50 编辑 ]






