• 2022-05-31
    以下代码输出结果为()class A{ public $a = 1; protected $b = 2;}class B extends A{ public $b = 3; function __construct(){ echo $this->a+$this->b; }}$b = new B();
    A: 1
    B: 2
    C: 3
    D: 4
  • D

    举一反三

    内容

    • 0

      以下代码调试结果 class Base {} class Sub extends Base {} public class CEx{ public static void main(String argv[]){ Base b = new Base(); Sub s = (Sub) b; } }

    • 1

      public class E4_1{ public static void main(String args[]) { int a = 1; int b = 2; int c = 3; a += 5; b *= 4; c += a * b; c %= 6; System.out.println("a = " + a); //代码1 System.out.println("b = " + b); //代码2 System.out.println("c = " + c); //代码3 }}运行结果,代码1______ ,代码2______ ,代码3______ 。

    • 2

      阅读以下程序,请写出代码1和代码2的运行结果 public class App3_1{ public static void main(String args[]) { int a=155; float b=20.0f; System.out.println("a="+a+",b="+b); //代码1 System.out.println("a/b="+(a/b)); //代码2 } }

    • 3

      >>>x = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]>>>x.index(2) 语句运行结果正确的是( )。 A: 1 B: 2 C: 3 D: 4

    • 4

      下列标注行中,( )行代码有错。 interface Com{ int MAX=100; //1 void f(); } abstract class Animal implements Com{ int MIN; //2 } class Dog extends Animal{ public void f(){ MIN=10; //3 MAX=200; //4 } } A: 1 B: 2 C: 3 D: 4