谁会做java程序填空题,求帮忙,谢了
1、写出下面程序运行之后的结果:classStaticInitDemo{staticinti;static{i=5;System.out.println("Staticc...
1、写出下面程序运行之后的结果:
class StaticInitDemo{
static int i;
static{
i =5;
System.out.println("Static code:i = " + i++);
}
}
public class TestStaticInit{
public static void main(String[] args) {
System.out.println("Main code: i = " + StaticInitDemo.i);
}
}
(1)运行结果为:______________________________________
2、写出下面程序运行之后的结果:
class Outer{
private int size;
class Inner{
void doStuff(){
size++;
System.out.println("The size value of the Outer class:" + size);
}
}
}
public class TestInner{
public static void main(String[] args) {
Outer out = new Outer();
Outer.Inner in = out.new Inner();
in.doStuff();
}
}
(2)运行结果为:______________________________________
3、写出下面程序运行之后的结果:
public class test {
public static void main(String[] args) {
int i = 0;
for (i++;i++<10; i++);
System.out.println(++i);
}
}
(3)运行结果为:______________________________________ 展开
class StaticInitDemo{
static int i;
static{
i =5;
System.out.println("Static code:i = " + i++);
}
}
public class TestStaticInit{
public static void main(String[] args) {
System.out.println("Main code: i = " + StaticInitDemo.i);
}
}
(1)运行结果为:______________________________________
2、写出下面程序运行之后的结果:
class Outer{
private int size;
class Inner{
void doStuff(){
size++;
System.out.println("The size value of the Outer class:" + size);
}
}
}
public class TestInner{
public static void main(String[] args) {
Outer out = new Outer();
Outer.Inner in = out.new Inner();
in.doStuff();
}
}
(2)运行结果为:______________________________________
3、写出下面程序运行之后的结果:
public class test {
public static void main(String[] args) {
int i = 0;
for (i++;i++<10; i++);
System.out.println(++i);
}
}
(3)运行结果为:______________________________________ 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询