• 2022-06-12
    using System; class Test { public static void Main() { int x = 5; int y = x++; Console.WriteLine(y); y=++x; Console.WriteLine(y); } }
  • 5 7

    内容

    • 0

      以下是"public static void test(int x, int y)"的方法重载( ) A: public static void Test(int x) B: public static int test(int x, int y) C: public static void test(int y, int x) D: public static void test(int x, int y)

    • 1

      阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。public class Test02{public static void Main(string[] args){int x = 12; {int y = 96;Console.WriteLine("x is " + x);Console.WriteLine("y is " + y);}y = x;Console.WriteLine("x is " + x);}}

    • 2

      请阅读下面的程序 public class Test { public static void main(String[] args) { int x; int y; for (x = 1, y = 1; x <= 100; x++) { if (y >= 20) { break; } if (y % 3 == 1) { y += 3; continue; } y -= 5; } System.out.println(“x=” + x + “,y=” + y); } } 下列选项中,哪一个是程序的运行结果( )

    • 3

      (6-6)请阅读程序,写出程序运行结果。 class Test{ static int x=10; int y=99; { y=y+10; } static { x=x+5; } { y=y+10; } static { x=x+5; } public Test() {//构造方法 x=x+5; } { System.out.println(x*y); } } public class Demo11 { public static void main(String[] args) { Test t1=new Test(); Test t2=new Test(); } }

    • 4

      下面程序输出的结果是( )。 #include<iostream> using namespace std; class A int X; public: A(int x):x(++x) ~A()cout<<x; ; class B:public A int y; public: B(int y):A(y),y(y) ~B()cout<<y;; ; void main() B b(3); A: 34 B: 43 C: 33 D: 44