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);
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);
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);
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);
第1题:
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
第2题:
阅读下面代码 abstract class Person { public Person(String n) { name=n; } public______String getDescription(); public String getName() { return name; } private String name; } 在下画线处应填入的修饰符是
A.static
B.abstract
C.protected
D.final
第3题:
给出下面不完整的类代码,则横线处的语句应该为( )。 class Person { String name,department; int age; public Person (Strings) {name=s;} public Person (String s,int
A.{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);
第4题:
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; }
第5题:
有如下XML代码段: <element>text</element> 可以通过哪些方法获得标记<element>中的数据“text”?
第6题:
public class Person { private name; public Person(String name) { this.name = name; } public int hashCode() { return 420; } } Which is true?()
第7题:
在Person的一个派生类Employee里调用Person类的构造函数正确方式为()。
第8题:
在J2EE中,假设sample.xml文档有一个元素是
第9题:
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?()
第10题:
The time to find the value from HashMap with a Person key depends on the size of the map.
Deleting a Person key from a HashMap will delete all map entries for all keys of typePerson.
Inserting a second Person object into a HashSet will cause the first Person object to beremoved as a duplicate.
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.
第11题:
base.Person(name,age)
base(name,age)
Person(name,age)
this(name,age)
第12题:
((Element)doc.getElementsByTagName(PERSON).item(0)).getNodeValue();
((Element)doc.getElementsByTagName(PERSON).item(0)).getElementsByTagName(NAME).item(0).getFirstChild().getNodeValue();
((Element)doc.getElementsByTagName(PERSON).item(0)).getElementsByTagName(NAME).item(0).getNodeValue();
((Element)doc.getElementsByTagName(PERSON).item(0)).item(0).getNodeValue();
第13题:
给出下列的不完整的类代码,则哪个语句可以被加到横线处? ( ) 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);
第14题:
给出下列的不完整的类代码,则下列的( )语句可以加到横线处。 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);
第15题:
为使下列代码正常运行,应该在下画线处填入的选项是( )。 abstract class person{ public Person(String n){ name=n: } Public String getDescription; public String getName{ return name; } private string name; }
A.static
B.private
C.abstract
D.final
第16题:
在J2EE中,使用()选项中的代码,可以生成如下XML文档:
第17题:
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?()
第18题:
下面的文件正确吗?为什么?用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>
第19题:
在J2EE中,假设sample.xml文档有一个元素是
第20题:
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?()
第21题:
((Element).doc.getElementsByTagName(“PERSON”).item(0)).getNodeValue;
((Element).doc.getElementsByTagName(“PERSON”).item(0)).getFristChild().getNodeValue();
((Element).doc.getElementsByTagName(“PERSON”).item(0)).getElementsByTagName(“NAME”).item(0).getNodeValue();
((Element).doc.getElementsByTagName(“PERSON”).item(0)).item(0).getNodeValue();
第22题:
Compilation fails because the hashCode method is not overridden.
A HashSet could contain multiple Person objects with the same name.
All Person objects will have the same hash code because the hashCode method is not overridden.
If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.
第23题:
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);
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);
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);
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);
第24题:
return super.hashCode();
return name.hashCode() + age * 7;
return name.hashCode() + comment.hashCode() /2;
return name.hashCode() + comment.hashCode() / 2 - age * 3;