• 2022-06-15
    分析下段代码输出结果是 var t = 10;function test(test){ t = t + test; var t = 3; console.log(t); } test(t);
    A: 6
    B: 3
    C: 13
  • B

    内容

    • 0

      var a = 10; function test() { console.log(a); var a = 100; console.log(a); } test(); console.log(a);

    • 1

      如下代码定义了一个类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);

    • 2

      查看一下代码 ,请问输出正确的是|var Test ={| foo:"test",| func:function () {| var self=this;| console.log(this.foo);| console.log(self.foo);| (function () {| console.log(this.foo);| console.log(self.foo);| })();| }|};|Test.func(); A: test test undefined test B: test undefined undefined test C: test test undefined D: test test test test

    • 3

      假设有类Test,下列可以正确创建对象的语句是( ) A: Test t=1; B: Test t=new Test(); C: Test t=new Test; D: Test t= Test();

    • 4

      给出如下类定义: public class Test { Test(int i) { } } 如果要创建一个该类的对象,正确的语句是( )。 A: Test t = newTest(); B: Test t = newTest(5); C: Test t = newTest("5"); D: Test t = newTest(3.4);