[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fRJg9Cqp7fdv131txkZM3OL9sBOOhH284rel4lu0dfto":3},{"answer":4,"createTime":5,"id":6,"options":7,"origin":12,"question":19,"related":20,"source":32,"type":57},[],"2024-06-01 12:43:31",147723919,[8,9,10,11],"A.java","A.class","B.java","B.class",{"count":13,"courseId":14,"courseImg":15,"courseName":16,"workId":17,"workName":18},15,"8936a979824fb65537a3b944cd317db9","https:\u002F\u002Ftihai-oss-cloud.itihey.com\u002Fimg\u002Fa06310862f916d3c02e2889c5e007e4e.webp","Java程序设计","3568414e57e54b07b5e63fee3d4de819","6.2构造方法小测验","对于下面代码,正确的Java源程序文件名是( ).class A { void method1() { System.out.println(&quot;Method1 in class A&quot;); }}public class B { void method2() { System.out.println(&quot;Method2 in class B&quot;); } public static void main(String[] args) { System.out.println(&quot;main() inclass B&quot;); }}",[21,34,44,54,58,67,76,85,94,103],{"answer":22,"createTime":5,"id":23,"options":24,"question":31,"source":32,"type":33},[],147723916,[25,26,27,28,29,30],"private Bag( ){ }","void Bag( ){ }","Bag( float x,float y){ }","public Bag(String str){ }","bag(){ }","int Bag(){ }","定义如下Bag类,( )是合法的Bag类的构造方法.class Bag{ float size; float color;}","v1",1,{"answer":35,"createTime":5,"id":36,"options":37,"question":43,"source":32,"type":33},[],147723917,[38,39,40,41,42],"默认构造方法初始化所有数据成员","默认构造方法有和它所在类相同的访问权限修饰符","默认构造方法调用其父类的无参构造方法","如果一个类没有无参构造方法,编译器会它创建一个默认构造方法","只有当一个类没有任何构造方法时,编译器会为它创建一个默认构造方法","关于Java的构造方法,下面哪些叙述是正确的?( )",{"answer":45,"createTime":5,"id":46,"options":47,"question":53,"source":32,"type":33},[],147723918,[48,49,50,51,52],"private Person(){ }","Person(String name,int age){ }","person(String name,int age){ }","public Person(String name,int age,char sex){ }","public void Person(String name,int age,char sex){ }","下面( )是Person类的构造方法",{"answer":55,"createTime":5,"id":6,"options":56,"question":19,"source":32,"type":57},[],[8,9,10,11],0,{"answer":59,"createTime":5,"id":60,"options":61,"question":66,"source":32,"type":57},[],147723920,[62,63,64,65],"构造方法不可以进行方法重载","构造方法用来初始化该类新对象的成员变量","构造方法具有和类名相同的名称","构造方法不返回任何值","关于构造方法,下列错误的说法是( )",{"answer":68,"createTime":5,"id":69,"options":70,"question":75,"source":32,"type":57},[],147723921,[71,72,73,74],"public static void main(String args[ ]){ }","static public void main(String arg[ ]){ }","public static void main(String [ ]args){ }","static public void main(String args){ }","下面( )不是Java应用程序中main方法的合法定义",{"answer":77,"createTime":5,"id":78,"options":79,"question":84,"source":32,"type":57},[],147723922,[80,81,82,83],"charAt()","endsWith()","indexOf()","substring()","从一个字符串中取出指定位置的字符,采用String类中的( )方法",{"answer":86,"createTime":5,"id":87,"options":88,"question":93,"source":32,"type":57},[],147723923,[89,90,91,92],"'d'","true","3","5","下面代码段输出结果是( ).String str=&quot;Work hard for dreams&quot;;System.out.println(str.indexOf('h'))",{"answer":95,"createTime":5,"id":96,"options":97,"question":102,"source":32,"type":57},[],147723924,[98,99,100,101],"void Sub(int x) {&hellip;&hellip;}","Sub(int x) {&hellip;&hellip;}","Sub Sub(int x) {&hellip;&hellip;}","int Sub(int x) {&hellip;&hellip;}","是类Sub的正确构造方法",{"answer":104,"createTime":5,"id":105,"options":106,"question":111,"source":32,"type":57},[],147723925,[107,108,109,110],"Java规定构造方法名与类名必须相同","Java规定构造方法没有返回值,但不用void声明","Java规定构造方法不可以重载","Java规定构造方法只能通过new自动调用","关于Java程序的构造方法,说法错误的是( )"]