2013年9月13日星期五

How no-argument constructor output of printf content

Such as the title , but it may point clearly , see the following procedure , and I want class A constructor A of the contents of the output is displayed, I do not know how to operate, please help !

[code=c]class A
{
int j;
public A()
{
System.out.printf("abc\n"); //要将这一部分输出怎么办呢?
}

public A(int i)
{
j = 20;
}
}

public class Test
{
public static void main(String[] args)
{
A aa = new A(20);
A bb = new A();
System.out.printf("%d\n", aa.j);

}
}
[/ code]
------ Solution --------------------------------- -----------
you do not have the output of the a bb = new A ();
------ Solution ------- -------------------------------------
has been output , ah , the landlord
- ----- For reference only ---------------------------------------
I was trying to "abc" output.
------ For reference only -------------------------------------- -
has been output , and that I did not see , thank you fudongrifdr.

没有评论:

发表评论