考题
在J2EE中,使用()选项中的代码,可以生成如下XML文档:PEOPLEPERSONNAMETonyBlair/NAME/PERSONPEOPLE
A.Elementpeople=doc.createElement(PEOPLE);Elementperson=doc.createElement(PERSON);Elementname=doc.createElement(NAME);name.appendChild(doc.createTextNode(TonyBlair));people.appendChild(person);person.appendChild(name);doc.appendChild(people);B.Elementpeople=doc.createElement(PEOPLE);Elementperson=doc.createElement(PERSON);people.appendChild(person);Elementname=doc.createElement(NAME);name.appendChild(doc.createTextNode(TonyBlair));person.appendChild(name);doc.appendChild(people);C.Elementpeople=doc.createElement(PEOPLE);Elementperson=doc.createElement(PERSON);people.appendChild(person);Elementname=doc.createElement(NAME);name.appendText(doc.createTextNode(TonyBlair));person.appendChild(name);doc.appendChild(people);D.Elementpeople=doc.createElement(PEOPLE);Elementperson=doc.createElement(PERSON);Elementname=doc.createElement(NAME);name.createTextNode(TonyBlair);people.appendChild(person);person.appendChild(name);doc.appendChild(people);
考题
在J2EE中,假设sample.xml文档有一个元素是,它有个子元素是。我们已经获得了Document对象doc,取出第一个的第一个资源的值的代码是()。
A.((Element)doc.getElementsByTagName(“PERSON”).item(0)).getNodeValue()B.((Element)doc.getElementsByTagName(“PERSON”).item(0)).getElementsByTagName(“NAME”).item(0).getFirstChild().getNodeValue()C.((Element)doc.getElementsByTagName(“PERSON”).item(0)).getElementsByTagName(“NAME”).item(0).getNodeValue()D.((Element)doc.getElementsByTagName(“PERSON”).item(0)).item(0).getNodeValue()
考题
为使下列代码正常运行,应该在下划线处填入的选项是abstract class Person{public Person(String n)!name=n;}public____String getDescription();public String getName(){return name;}private String name;}A.staticB.privateC.abstractD.final
考题
阅读下列代码段 abstract class Person{ public Person(String n){ name=n; } public______String getDescription(); public String getName(){ } private String name; } 在下画线处应填入的修饰符是A.staticB.abstractC.protectedD.final
考题
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);
考题
阅读下面代码 abstract class Person { public Person(String n) { name=n; } public______String getDescription(); public String getName() { return name; } private String name; } 在下画线处应填入的修饰符是A.staticB.abstractC.protectedD.final
考题
给出下列的不完整的类代码,则下列的( )语句可以加到横线处。 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);
考题
给出下面不完整的类代码,则横线处的语句应该为( )。 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);
考题
为使下列代码正常运行,应该在下画线处填入的选项是( )。 abstract class person{ public Person(String n){ name=n: } Public String getDescription; public String getName{ return name; } private string name; }A.staticB.privateC.abstractD.final
考题
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; }
考题
在J2EE中,使用()选项中的代码,可以生成如下XML文档: Tony Blair A、Element people = doc.createElement("PEOPLE"); Element person = doc.createElement("PERSON"); Element name = doc.createElement("NAME"); name.appendChild(doc.createTextNode("Tony Blair")); people.appendChild(person); person.appendChild(name); doc.appendChild(people);B、Element people = doc.createElement("PEOPLE"); Element person = doc.createElement("PERSON"); people.appendChild(person); Element name = doc.createElement("NAME"); name.appendChild(doc.createTextNode("Tony Blair")); person.appendChild(name); doc.appendChild(people);C、Element people = doc.createElement("PEOPLE"); Element person = doc.createElement("PERSON"); people.appendChild(person); Element name = doc.createElement("NAME"); name.appendText(doc.createTextNode("Tony Blair")); person.appendChild(name); doc.appendChild(people);D、Element people = doc.createElement("PEOPLE"); Element person = doc.createElement("PERSON");Element name = doc.createElement("NAME"); name.createTextNode("Tony Blair"); people.appendChild(person); person.appendChild(name); doc.appendChild(people);
考题
有如下XML代码段: <element>text</element> 可以通过哪些方法获得标记<element>中的数据“text”?
考题
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;
考题
public class Person { private name; public Person(String name) { this.name = name; } public int hashCode() { return 420; } } Which is true?() A、 The time to find the value from HashMap with a Person key depends on the size of the map.B、 Deleting a Person key from a HashMap will delete all map entries for all keys of typePerson.C、 Inserting a second Person object into a HashSet will cause the first Person object to beremoved as a duplicate.D、 The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.
考题
下面的文件正确吗?为什么?用IE和本章中的解析器验证你的结论。 mes.dtd <!ELEMENT message ANY> <!ELEMENT persion (name,age?,lxfs)> <!ELEMENT lxfs (#PCDATA,tel|email)*> <!ELEMENT name (first,last)> <!ATTLIST name sex (male|female) "male"> <!ELEMENT first %pc; > <!ELEMENT last %pc;> <!ELEMENT age %pc;> <!ELEMENT tel %pc;> <!ELEMENT email %pc;> <!ENTITY % pc “(#PCDATA)”> <!ELEMENT emergency EMPTY> <!ATTLIST emergency fire CDATA #FIXED "119" police CDATA #FIXED "110" hospital CDATA #FIXED "120" > mes.xml <?xml version="1.0" encoding="gb2312"?> <!DOCTYPE SYSTEM "mes.dtd"> <message> <persion> <name sex="男"> <first>li</first> <last>xiao</last> </name> <age>25</age> <lxfs> <tel>123456</tel> </lxfs> </persion> <persion> <name> <first>wang</first> <last>xiao</last> </name> <lxfs></lxfs> </persion> <emergency fire="120" police="110" /> </message>
考题
在Person的一个派生类Employee里调用Person类的构造函数正确方式为()。A、base.Person(name,age)B、base(name,age)C、Person(name,age)D、this(name,age)
考题
在J2EE中,假设sample.xml文档有一个元素是,它有个子元素是。我们已经获得了Document对象doc,取出第一个的第一个子元素的值的代码是()。 A、((Element).doc.getElementsByTagName(“PERSON”).item(0)).getNodeValue;B、 ((Element).doc.getElementsByTagName(“PERSON”).item(0)).getFristChild().getNodeValue();C、 ((Element).doc.getElementsByTagName(“PERSON”).item(0)).getElementsByTagName(“NAME”).item(0).getNodeValue();D、 ((Element).doc.getElementsByTagName(“PERSON”).item(0)).item(0).getNodeValue();
考题
在J2EE中,假设sample.xml文档有一个元素是,它有个子元素是。我们已经获得了Document对象doc,取出第一个的第一个资源的值的代码是()。 A、((Element)doc.getElementsByTagName(“PERSON”).item(0)).getNodeValue()B、((Element)doc.getElementsByTagName(“PERSON”).item(0)).getElementsByTagName(“NAME”).item(0).getFirstChild().getNodeValue()C、((Element)doc.getElementsByTagName(“PERSON”).item(0)).getElementsByTagName(“NAME”).item(0).getNodeValue()D、((Element)doc.getElementsByTagName(“PERSON”).item(0)). item(0).getNodeValue()
考题
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);
考题
public class Person { private name; public Person(String name) { this.name = name; } public boolean equals(Object o) { if( !o instanceof Person ) return false; Person p = (Person) o; return p.name.equals(this.name); } } Which is true?() A、 Compilation fails because the hashCode method is not overridden.B、 A HashSet could contain multiple Person objects with the same name.C、 All Person objects will have the same hash code because the hashCode method is not overridden.D、 If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.
考题
单选题在J2EE中,假设sample.xml文档有一个元素是,它有个子元素是。我们已经获得了Document对象doc,取出第一个的第一个子元素的值的代码是()。A
((Element).doc.getElementsByTagName(“PERSON”).item(0)).getNodeValue;B
((Element).doc.getElementsByTagName(“PERSON”).item(0)).getFristChild().getNodeValue();C
((Element).doc.getElementsByTagName(“PERSON”).item(0)).getElementsByTagName(“NAME”).item(0).getNodeValue();D
((Element).doc.getElementsByTagName(“PERSON”).item(0)).item(0).getNodeValue();
考题
单选题public class Person { private name; public Person(String name) { this.name = name; } public int hashCode() { return 420; } } Which is true?()A
The time to find the value from HashMap with a Person key depends on the size of the map.B
Deleting a Person key from a HashMap will delete all map entries for all keys of typePerson.C
Inserting a second Person object into a HashSet will cause the first Person object to beremoved as a duplicate.D
The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.
考题
单选题public class Person { private name; public Person(String name) { this.name = name; } public boolean equals(Object o) { if( !o instanceof Person ) return false; Person p = (Person) o; return p.name.equals(this.name); } } Which is true?()A
Compilation fails because the hashCode method is not overridden.B
A HashSet could contain multiple Person objects with the same name.C
All Person objects will have the same hash code because the hashCode method is not overridden.D
If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.
考题
单选题在Person的一个派生类Employee里调用Person类的构造函数正确方式为()。A
base.Person(name,age)B
base(name,age)C
Person(name,age)D
this(name,age)
考题
多选题在J2EE中,使用()选项中的代码,可以生成如下XML文档: Tony BlairAElement people = doc.createElement(PEOPLE); Element person = doc.createElement(PERSON); Element name = doc.createElement(NAME); name.appendChild(doc.createTextNode(Tony Blair)); people.appendChild(person); person.appendChild(name); doc.appendChild(people);BElement people = doc.createElement(PEOPLE); Element person = doc.createElement(PERSON); people.appendChild(person); Element name = doc.createElement(NAME); name.appendChild(doc.createTextNode(Tony Blair)); person.appendChild(name); doc.appendChild(people);CElement people = doc.createElement(PEOPLE); Element person = doc.createElement(PERSON); people.appendChild(person); Element name = doc.createElement(NAME); name.appendText(doc.createTextNode(Tony Blair)); person.appendChild(name); doc.appendChild(people);DElement people = doc.createElement(PEOPLE); Element person = doc.createElement(PERSON);Element name = doc.createElement(NAME); name.createTextNode(Tony Blair); people.appendChild(person); person.appendChild(name); doc.appendChild(people);
考题
单选题在J2EE中,假设sample.xml文档有一个元素是,它有个子元素是。我们已经获得了Document对象doc,取出第一个的第一个子元素的值的代码是()。A
((Element)doc.getElementsByTagName(PERSON).item(0)).getNodeValue();B
((Element)doc.getElementsByTagName(PERSON).item(0)).getElementsByTagName(NAME).item(0).getFirstChild().getNodeValue();C
((Element)doc.getElementsByTagName(PERSON).item(0)).getElementsByTagName(NAME).item(0).getNodeValue();D
((Element)doc.getElementsByTagName(PERSON).item(0)).item(0).getNodeValue();
考题
单选题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;