多选题35. String #name = “Jane Doe”; 36. int$age=24; 37. Double_height = 123.5; 38. double~temp = 37.5; Which two are true?()ALine 35 will not compile.BLine 36 will not compile.CLine 37 will not compile.DLine 38 will not compile.
多选题
35. String #name = “Jane Doe”; 36. int$age=24; 37. Double_height = 123.5; 38. double~temp = 37.5; Which two are true?()
A
Line 35 will not compile.
B
Line 36 will not compile.
C
Line 37 will not compile.
D
Line 38 will not compile.
参考解析
解析:
暂无解析
相关考题:
下列程序的输出结果为main (){union u{char *name;int age;int income;}ss.name="WANGLIONG";s.age=28;s.income=1000;printf("%d\n",s.age);}A.28B.1000C.0D.不确定
本题中定义了一个带有参数的构造方法javal,并定义了一个该类的对象temp。构造方法javal有两个参数:字符串name和整型age。定义对象temp时将字符串“Tom"和整数17传递给构造方法,构造方法将这两个参数打印输出。 public class javal{ String name; int age; public static void main(String[]args){ String name="Tom"; int age=17; javal temp = ; } public javal(String name, ){ ; this.age= age; System.out.println(name+"is"+age+" years old."); } }
设有下列两个类的定义,则类Person和类Man的关系是( )。 class Person { long id; //身份证号 String name; //姓名 } class Man extends Person { int age; //年龄 int getAge() { return age; } }A.包含关系B.继承关系C.关联关系D.无关系,上述类定义有语法错误
class Person{ String name,department; int age; public Person(Stringn){name=n;} public Person(String n, int a){name=n;age=a;} publicPerson(String n,String d,int a){ doing the same as two argumentsversion of constructer including assignment name=n,age=a } } 下列哪一个选项可以添加到“doing the same....”处?()APerson(n,a)Bthis(Person(n,a))Cthis(n,a)Dthis(name,age
给出下列的不完整的类代码,则哪个语句可以被加到横线处? ( ) class Person{ String name,department; int age; public Person(String n){name=n;} public Person(String n,int s){name=n; age=a;} public Person(String n,String d,int a){ department=d;______ } }A.Person(n,a);B.this(Person(n,a));C.this(n,s);D.this(name,age);
有以下程序:includeincludeusingnameSpacestd;classperson{ intage; Char*nam 有以下程序:include <iostream>include <string>using nameSpace std;class person{int age;Char * name;public:person ( int i, Char * str ){int j;j = strlen( str ) + 1;name = new char[ j ];strcpy( name, str );age = i;}~person(){delete name;cout<<"D";}void display(){cout<<name<<":"<<age;}};int main(){person demo( 30,"Smith" );demo.display();return 0;}则该程序的输出结果为:【 】。
给出下列的不完整的类代码,则下列的( )语句可以加到横线处。 class Person{ String name,department; int age public Person(String n){name=n;} public Person(String n,int a){name=n;age=a;} pubilc Person(String n,String d,int a) { _______________ department=d; } }A.Person(n,a);B.this(Person(n,a));C.this(n,a);D.this(name,age);
有如下语句: Type Student Name As String Age As Integer Sex As String End Type Dim Stu As Student With Stu .Name="张红" .Age=22 .Sex="女" End With 执行Print Stu.Age语句后的结果是A.张红B.22C.“女”D.Age
给出下面不完整的类代码,则横线处的语句应该为( )。 class Person { String name,department; int age; public Person (Strings) {name=s;} public Person (String s,intA.{name=s;age=a;} public Person (String n,String d,intA){ __________ department=d; } }A)Person (n,A);B.this (Person(n,A));C.this(n,A);D.this(name,age);
阅读以下说明和Java 码,将应填入(n)处的字名写在的对应栏内。[说明] 编写一个学生类Student,要求:(1) 学生类Student 属性有:id: long 型,代表学号name: String类对象,代表姓名age: int 型,代表年龄sex: boolen 型,代表性别(其中:true 表示男,false 表示女)phone: String 类对象,代表联系电话(2) 学生类Student 的方法有:Student (long i,String n,int a,boolean s,String p):有参构造函数,形参表中的参数分别初始化学号、姓名、年龄、性别和联系电话。int getAge ():获取年龄作为方法的返回值。boolean getSex ():获取性别作为方法的返回值。String getPhone ():获取联系电话作为方法的返回值。public String to String ():以姓名:性别:学号:联系电话的形式作为方法的返import java. applet. Applet;import java. awt.* ;public class Student extends Applet {long id;String name, phone;int age;boolean sex;Student(long i, String n, int a, boolean s, String p){id=i;name = n;age = a;sex= s;phone = p;{public void paint( Graphics g){Student x= new Student (5000," xiaoliu" , 89, true, " 8989898" );(1);(2)g. drawstring( x. getPhone( ), 140,140);}int getAge( ){ return age; }boolean getsex ( ){ return sex; }String getPhone( ){ return phone; }String ToString( ){(3)}}
请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl。程序中位于每个“//ERROR****found料****之后的一行语句有错误,请加以改正。改正后程序的输出结果应为: Name:Smith Age:21 ID:99999 CourseNum:12 Record:970 注意:只修改每个“//ERROR****found****”下的那一行,不要改动程序中的其他内容。 includeiostream using namespace std; class Studentlnfo { protected: //ERROR********************found**************** char Name; int Age; int ID: int CourseNum; float Record; public: Studentlnfo(char*name,int Age,int ID,int coumeNum,float record); //ERROR ********************found******************** void~Studentlnfo{} float AverageRecord{ return Record/CourseNum; } void showconst{ cout”Name:”Name”Age:”Age”ID:”ID ”CourseNum:”CourseNum”Record:”Recordendl; } }; //ERROR ******************found************** StudentInfo StudentInfo(char*Name,int Age,int ID,int CourseNum,float Record) { Name=name; Age=age; this一ID=ID: CourseNum=courseNum: Record=record; } int main { Studentlnfo st(’’Smith”,21,99999,12,970); st.show; return 0; }
Person p = new Person(“张三”,23);这条语句会调用下列哪个构造方法给属性进行初始化() A.public Person(){}B.public Person(String name,int age) { this.name = name; this.age = age; }C.public Person(int age,String name) { this.age = age; this.name = name; }D.public Person(String name) { this.name = name; }
下列关于结构型变量的定义语句中,错误的是( )A.typedef struct CCCB.define GGG struct { char name[20];GGG CCC { char name[20]; int age; int age; }GGG; }; GGG abc ; GGG CCC abc;C.structD.struct { char name[20]; { char name[20]; int age; int age; }ccc; }abc; CCC abc;
有下列语句: struct Birthday{public int year; public int month; public int day;}; struct Student{ int no; string name; int age; public Birthday bir; }; …… Student Stu; 如果要把Stu的出生年份赋值为1988,正确的语句是()A、 Stu.bir.year=1988;B、 Stu.year=1988;C、 Stu. Birthday.year=1988;D、 Student. Birthday.year=1988;
public class Person { private String name, comment; private int age; public Person(String n, int a, String c) { name = n; age = a; comment = c; } public boolean equals(Object o) { if(! (o instanceof Person)) return false; Person p = (Person)o; return age == p.age name.equals(p.name); } } What is the appropriate definition of the hashCode method in class Person?() A、 return super.hashCode();B、 return name.hashCode() + age * 7;C、 return name.hashCode() + comment.hashCode() /2;D、 return name.hashCode() + comment.hashCode() / 2 - age * 3;
类Student代码如下: class Student{ String name; int age; Student(String nm){ name = nm; } } 执行语句Student stu = new Student()后,字段age的值是哪项?() A、 0B、 nullC、 falseD、 编译错误
类Student的声明如下: package com.school class Student{ String name; int age; Student(String name,int age){ //code } void study(String subject){ / /code } } 正确调用方法study(String subject)的是哪项?() A、Student stu = new Student(“Tom”,23); stu.study(“数学”);B、Student.study(“数学”);C、Student stu = new Student(“Tom”,23); stu.study();D、Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);
类 Student 中字段mark的缺省值是哪项?() Class Student{ String name; int age; float market; ········· } A、0.0fB、numllC、falseD、0E、0.0
单选题下面哪个方法设置MIME类型?()AsetHeader(String headerName,String headerValue)BsetContentType(String mimeType)CsetContentLength(int length)DaddCookie(Cookie c)EaddHeader(String name,String value)
单选题类Student代码如下: class Student{ String name; int age; Student(String nm){ name = nm; } } 执行语句Student stu = new Student()后,字段age的值是哪项?()A 0B nullC falseD 编译错误
多选题35.String #name="Jane Doe";36.int$age=24;37.Double_height=123.5;38.double~temp=37.5;Which two are true?()ALine 35 will not compile.BLine 36 will not compile.CLine 37 will not compile.DLine 38 will not compile.
多选题Given: 35.String #name = "Jane Doe"; 36.int $age = 24; 37.Double _height = 123.5; 38.double ~temp = 37.5; Which two statements are true?()ALine 35 will not compile.BLine 36 will not compile.CLine 37 will not compile.DLine 38 will not compile.
单选题33. Date d = new Date(0); 34. String ds = “December 15, 2004”; 35. // insert code here 36. try { 37. d = df.parse(ds); 38. } 39. catch(ParseException e) { 40. System.out.println(”Unable to parse “+ ds); 41. } 42. // insert code here too Which will create the appropriate DateFormat object and add a day to the Date object?()A 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setTime( (60 * 60 * 24) +d.getTime());B 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setTime( (1000 * 60 * 60 * 24) + d.getTime());C 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setLocalTime( (1000*60*60*24) + d.getLocalTime());D 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setLocalTime( (60 * 60 * 24) + d.getLocalTime());
单选题public class Person { private String name, comment; private int age; public Person(String n, int a, String c) { name = n; age = a; comment = c; } public boolean equals(Object o) { if(! (o instanceof Person)) return false; Person p = (Person)o; return age == p.age name.equals(p.name); } } What is the appropriate definition of the hashCode method in class Person?()A return super.hashCode();B return name.hashCode() + age * 7;C return name.hashCode() + comment.hashCode() /2;D return name.hashCode() + comment.hashCode() / 2 - age * 3;
单选题类Student代码如下:D class Student{ String name; int age; Student(String nm){ (构造方法) name = nm; } } 执行语句Student stu = new Student()后,字段age的值是哪项?()A 0B nullC falseD 编译错误
多选题35. String #name = “Jane Doe”; 36. int$age=24; 37. Double_height = 123.5; 38. double~temp = 37.5; Which two are true?()ALine 35 will not compile.BLine 36 will not compile.CLine 37 will not compile.DLine 38 will not compile.
单选题10. public class ClassA { 11. public void methodA() { 12. ClassB classB = new ClassB(); 13. classB.getValue(); 14. } 15. } And: 20. class ClassB { 21. public ClassC classC; 22. 23. public String getValue() { 24. return classC.getValue(); 25. } 26. } And: 30. class ClassC { 31. public String value; 32. 33. public String getValue() { 34. value = “ClassB”; 35. return value; 36. } 37. } Given: ClassA a = new ClassA(); a.methodA(); What is the result?()A Compilation fails.B ClassC is displayed.C The code runs with no output.D An exception is thrown at runtime.
单选题Given the uncompleted code of a class: class Person { String name, department; int age; public Person(String n){ name = n; } public Person(String n, int a){ name = n; age = a; } public Person(String n, String d, int a) { // doing the same as two arguments version of constructor // including assignment name=n,age=a department = d; } } Which expression can be added at the "doing the same as..." part of the constructor?()A Person(n,a);B this(Person(n,a));C this(n,a);D this(name,age);