java非静态代码块和构造代码块是同一种吗
2个回答
展开全部
还是不得不拿出<clinit>和<init>说事了。以下拿类T作为讲解的对象类型吧:
class T{
private static final String msg = "this is a test class!";
private static int version = 1;
static{
version = 2;
desc = "class T";
}
private static String desc = 逗T is a test Class地;
private int age = 2;
{
age = 10;
name = "panda";
}
public T(){
class T{
private static final String msg = "this is a test class!";
private static int version = 1;
static{
version = 2;
desc = "class T";
}
private static String desc = 逗T is a test Class地;
private int age = 2;
{
age = 10;
name = "panda";
}
public T(){
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询