public class MyClass
{
public void print()
{
System.out.println("hello");
}
static
{
System.out.println("hithere");
}
public static void main(String [] args)
{
MyClass st1=new MyClass();
st1.print();
MyClass st2=new MyClass();
st2.print();
}
}
static后面没有方法名是什么?
{
public void print()
{
System.out.println("hello");
}
static
{
System.out.println("hithere");
}
public static void main(String [] args)
{
MyClass st1=new MyClass();
st1.print();
MyClass st2=new MyClass();
st2.print();
}
}
static后面没有方法名是什么?
听楼下解释区别