• 2022-06-06 问题

    当单击按钮(设按钮的ID值为“btn”)是触发函数“showName()”,下面代码不正确的是( )。 A: btn.addEventListener(‘click’, showName, false) B: btn.addEventListener(‘click’, showName); C: btn.attachEvent(‘onclick’,showName); D: btn.attachEvent(‘click’, showName);

    当单击按钮(设按钮的ID值为“btn”)是触发函数“showName()”,下面代码不正确的是( )。 A: btn.addEventListener(‘click’, showName, false) B: btn.addEventListener(‘click’, showName); C: btn.attachEvent(‘onclick’,showName); D: btn.attachEvent(‘click’, showName);

  • 2022-06-09 问题

    下面的程序中,哪行会报错? public class StaticTest { int age; String name; static int totalFee = 500; public void showName() { System.out.print(this.name); } public static void showTotalFee() { line 1: System.out.print(totalFee); line 2: showName(); } public static void main(String[] args) { line3: StaticTest.showTotalFee(); } }

    下面的程序中,哪行会报错? public class StaticTest { int age; String name; static int totalFee = 500; public void showName() { System.out.print(this.name); } public static void showTotalFee() { line 1: System.out.print(totalFee); line 2: showName(); } public static void main(String[] args) { line3: StaticTest.showTotalFee(); } }

  • 2021-04-14 问题

    下面的程序中,哪行会报错? publicclassStaticTest{ intage; Stringname; staticinttotalFee=500; publicvoidshowName(){ System.out.print(this.name); } publicstaticvoidshowTotalFee(){ line1:System.out.print(totalFee); line2:showName(); } publicstaticvoidmain(String[]args){ line3:StaticTest.showTotalFee(); } }

    下面的程序中,哪行会报错? publicclassStaticTest{ intage; Stringname; staticinttotalFee=500; publicvoidshowName(){ System.out.print(this.name); } publicstaticvoidshowTotalFee(){ line1:System.out.print(totalFee); line2:showName(); } publicstaticvoidmain(String[]args){ line3:StaticTest.showTotalFee(); } }

  • 2022-06-15 问题

    在C#中,下列结构或者类定义正确的是(选一项) A: public struct Person{ string name; int age; public void ShowName(){ Console.WriteLine(name); }} B: public struct Person{ string name; int age; public Person(){ Conssole.WriteLine(name); }} C: public class Person{ string name; int age; public Person(){ Conssole.WriteLine(name); }} D: public class Person{ string name; int age; public Person(string name){ Conssole.WriteLine(name); }}

    在C#中,下列结构或者类定义正确的是(选一项) A: public struct Person{ string name; int age; public void ShowName(){ Console.WriteLine(name); }} B: public struct Person{ string name; int age; public Person(){ Conssole.WriteLine(name); }} C: public class Person{ string name; int age; public Person(){ Conssole.WriteLine(name); }} D: public class Person{ string name; int age; public Person(string name){ Conssole.WriteLine(name); }}

  • 2021-04-14 问题

    【其它】应用构造函数创建一个图书对象Book,该对象有3个属性:name,type,price,一个方法showName。然后创建对象实例,通过对象实例调用对象中的方法显示书名,然后应用for...in循环语句输出对象中的所有属性和值。。 实现步骤: (1)定义构造函数Book(), 在函数中应用this关键字初始化对象中的属性和方法 (2)创建两个不同的对象实例,对每个对象实例调用对象中的方法,应用for...in循环语句输出对象中的所有属性和值。 (运行效果+代码拍照添加到答案中,一张图即可)

    【其它】应用构造函数创建一个图书对象Book,该对象有3个属性:name,type,price,一个方法showName。然后创建对象实例,通过对象实例调用对象中的方法显示书名,然后应用for...in循环语句输出对象中的所有属性和值。。 实现步骤: (1)定义构造函数Book(), 在函数中应用this关键字初始化对象中的属性和方法 (2)创建两个不同的对象实例,对每个对象实例调用对象中的方法,应用for...in循环语句输出对象中的所有属性和值。 (运行效果+代码拍照添加到答案中,一张图即可)

  • 1