类test的定义如下,$x是类test的对象,则4个选项中,正确的是( )。class test{const no='110';}$x=new test( );
A: echo $x.no;
B: echo $x->no;
C: echo test->no;
D: echo test::no;
A: echo $x.no;
B: echo $x->no;
C: echo test->no;
D: echo test::no;
举一反三
- 设有泛型类的定义如下class Test; { }则由该类创建对象时,使用正确的是? A: Test; x = new Test;(); B: Test x = new Test(); C: Test; x = new Test;(); D: Test; x = new Test;();
- 如下代码定义了一个类Test: class Test { private int y; Test (int x) { y:x; } }现在为Test 类生成一个对象,正确的语句是( )。 A: Test t = new Test( ); B: Test t=new Test(10, 20); C: Test t; D: Test t=new Test(10);
- 设有泛型类的定义如下class Test<T> { }则由该类创建对象时,使用正确的是? A: Test x = new Test();<table width="77" cellspacing="0" cellpadding="0"><colgroup><tbody><tr class="firstRow">数据添加到文件中; B: Test<int> x = new Test<int>(); C: Test<Object> x = new Test<Object>(); D: Test<T> x = new Test<T>();
- 以下操作能实现追加写入文件的是 A: echo "hello" > /tmp/test B: echo "hello" >> /tmp/test C: print "hello " >> /tmp/test D: printf "hello " >> /tmp/test
- 执行下面的代码后,输出结果为( )。class test{public $data;}Sx=new test();$x->data=100;$y=$x;$y->data=10;echo $x->data; A: 100 B: 10 C: 0 D: null