针对Set s接口,下列哪项是正确的?() A、 s.add(2)B、 s.add(new Integer(2))C、 s.add(“2”)D、 s.add(new java.util.Date())

针对Set s接口,下列哪项是正确的?() 

  • A、 s.add(2)
  • B、 s.add(new Integer(2))
  • C、 s.add(“2”)
  • D、 s.add(new java.util.Date())

相关考题:

本题中,用表格表现某个月的月历,其中标题是从Sunday到Saturday,表格中的各项是可以修改的。 import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; public class java2 ( public static void main(String[]args) { try{ UIManager.setLookAndFeel(UIManager.getSys- temLookAndFeelClassName): } catch(Exception e) JFrame. frame=new CalendarTableFrame; frame.setDefaultCloseOperation(JFrame.EXIT_ oN CLOSE); frame.show; } } clasgCalendarTableFrame. extends JFrame { private static final int WIDTH=500; private static final int HEIGHT=150: private cells= { {null,null,null,new Integer(1),new Integer (2),new Integer(3),new Integer(4)), {new Integer(5),new Integer(6),new Integer (7).new Integer(8),new Integer(9),new Integer (10),new Integer(11)), {new Integer(12),new Integer(13),new Integer (14),new Integer(15),new Integer(16),new Integer (17),new Integer(18)), {new Integer(19),new Integer(20),new Integer (21),new Integer(22),new Integer(23),new Integer (24),new Integer(25)), {new Integer(26),new Integer(27),new Integer (28),new Integer(29),new Integer(30),new Integer (31),null} }; private String[]columnNames={ "Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday" }; public CalendarTableFrame{ setTitle("java2"); setSize(WIDTH,HEIGHT); JTable table=new ; getContentPane.add(new JScrollPane(table), BorderLayout.CENTER); } }

下列Application程序中,指定as为字符串数组类型,先创建一个HashSet对象并赋值,然后在屏幕输出s,请将程序补充完整。import java.util.*;public class test17_1{public static void main(String[] args){__________s=new HashSet();s.add("Hello");s.add("World");s.add(new Character('我'));s.add(new Integer(23));s.add("Hello");__________as={"W","o","r","1","d"};s.add(as);s.add(null);s.add(new Integer(23));s.add(null);System.out.println(__________);

下列语句中错误的是( )。A.int a[][]=new int[2][];B.int a[][]=new int[][];C.int a[][]=new int[2][3];D.int[][] a=new int[3][2];

下面的程序的运行结果是__________type Slice []intfunc NewSlice() Slice {return make(Slice, 0)}func (s* Slice) Add(elem int) *Slice {*s = append(*s, elem)fmt.Print(elem)return s}func main() { s := NewSlice()defer s.Add(1).Add(2)s.Add(3)}

针对Sets接口,下列哪项是正确的?() A.s.add(2)B.s.add(newInteger(2))C.s.add(“2”)D.s.add(newjava.util.Date())

Given:Which code, inserted at line 4, guarantees that this program will output [1, 2]()? A.Set set = new TreeSet();B.Set set = new HashSet();C.Set set = new SortedSet();D.List set = new SortedList();E.Set set = new LinkedHashSet();

下列程序段不正确的是()。 A、string A=“firstJava”B、StringA= “firstJava”,A+=“Java”C、IntegerJ=new Integer(27),J-=7D、IntegerJ=new Integer(27),J- -

下列程序段: String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1==s2)); 的结果为A.falseB.trueC.1D.0

在下列程序的空白处,应填入的正确选项是( )。 Import java.io.*; Pulilc class ObjectStreamTest{ Publilc static void main(string args[])throws IOEx- ception{ OhiectOutputStream os=new OhjectOutputStream (new FileOutputStream("serial.bin")); Java.util.Date d=new Java.util.Date; Oos (d); ObjectInputStream is= new OhjectlnputStream(new FileOutputStream("serial. bin")); try{ java.util.date restoredDate= (Java.util.Date)ois.readObject; System.out.println ("read object back from serial.bin file:" +restoredDate); } Catch(ClassNotFoundException cnf){ System.out.println("class not found"); } }A.WriterObjectB.WriterC.BufferedWriterD.writerObject

( 34 )在下列程序的空白处,应填入的正确选项是Import java.io.*;Pulilc class ObjectStreamTest{Publilc static void main(string args[]) throws IOException{ObjectOutputStream s= new ObjectOutputStream(new FileOutputStream( “ serial.bin ” ));Java .util.Date d= new Java.util.Date();Oos___________ (d);ObjectInputStream is=new ObjectInputStream(new FileOutputStream( “ serial.bin ” ));try{java.util.date restoredDate =(Java.util.Date) ois.readObject();System.out.println( “ read object back from serial.bin file: ”+ restoredDate);}Catch (ClassNotFoundException cnf) {System.out.println ( “ class not found ” );}}A ) WriterObjectB ) WriterC )BufferedWriterD ) WriterObject

Dim arrInt()as Integer=New Integer(3){0,1,2}

Dim arrInt()as Integer=New Integer(2){}

1. import java.util.*;  2. class AddStuff {  3. public static void main(String [] args) {  4. TreeSet〈String〉 s = new TreeSet〈String〉();  5. s.add("one");  6. s.add("two");  7. // insert code here  8. for(String s2 : sorted)  9. System.out.print(s2 + " ");  10. }  11. }  和四个代码片段:  s1. SortedSet sorted = s.tailSet(s.first());  s2. SortedSet〈String〉 sorted = s.tailSet(s.first());  s3. SortedSet sorted = (SortedSet)s.tailSet(s.first());  s4. SortedSet sorted = (SortedSet〈String〉)s.tailSet(s.first());  分别插入到第7行,哪项可以编译?() A、s1B、s2C、s2 和 s3D、s2 和 s4

现有:  1.  import java.util.*;      2.  class AddStuff  {  3.public static void main (String  []  args)    {      4.TreeSet  s= new TreeSet();      5.    s.add( "one"):      6.    s.add( "two"):  7.    //insert code here      8.for (String s2:  sorted)      9.System.out.print (s2+" ");      10.    }     11.  }  和四个代码片段:  s1.sortedSet  sorted=s.tailSet(s.first());  s2.sortedSet  sorted=s.tailSet(s.first());  s3.sortedSet  sorted=  (SortedSet)s .tailSet(s.first());  s4.SortedSet  sorted=  (SortSet)s .tailSet(s.first()); 分别插入到第7行,哪项可以编译?()     A、s2B、slC、s2和s3D、s2和s4E、s2, s3和s4F、sl. s2. s3和s4

Dim arrInt()as Integer=New Integer(2){0,1,2}

1. import java.util.*;  2. public class Example {  3. public static void main(String[] args) {  4. // insert code here  5. set.add(new integer(2));  6. set.add(new integer(l));  7. System.out.println(set);  8. }  9. }  Which code, inserted at line 4, guarantees that this program will output [1,2]? ()A、 Set set = new TreeSet();B、 Set set = new HashSet();C、 Set set = new SortedSet();D、 List set = new SortedList();E、 Set set = new LinkedHashSet();

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE You issue these statements: CREATE table new_emp ( employee_id NUMBER, name VARCHAR2(30)); INSERT INTO new_emp SELECT employee_id , last_name from employees; Savepoint s1; UPDATE new_emp set name = UPPER(name); Savepoint s2; Delete from new_emp; Rollback to s2; Delete from new_emp where employee_id =180; UPDATE new_emp set name = 'James'; Rollback to s2; UPDATE new_emp set name = 'James' WHERE employee_id =180; Rollback; At the end of this transaction, what is true?()A、You have no rows in the table.B、You have an employee with the name of James.C、You cannot roll back to the same savepoint more than once.D、Your last update fails to update any rows because employee ID 180 was already deleted.

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE You issue these statements: CREATE table new_emp ( employe_id NUMBER, name VARCGAR2(30)); INSERT INTO new_emp SELECT employee_id, last_name from employees; Savepoint s1; UPDATE new_emp set name = UPPER(name); Savepoint s2; Delete from new_emp; Rollback to s2; Delete from new_emp where employee_id=180; UPDATE new_emp set name = 'James'; Rollback to s2; UPDATE new_emp sey name = 'James' Where employee_id=180; Rollback; At the end of this transaction, what is true?()A、You have no rows in the table.B、You have an employee with the name of James.C、You cannot roll back to the same savepoint more than once.D、Your last update fails to update any rows because employee ID 180 was already deleted.

单选题Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE You issue these statements: CREATE table new_emp ( employee_id NUMBER, name VARCHAR2(30)); INSERT INTO new_emp SELECT employee_id , last_name from employees; Savepoint s1; UPDATE new_emp set name = UPPER(name); Savepoint s2; Delete from new_emp; Rollback to s2; Delete from new_emp where employee_id =180; UPDATE new_emp set name = 'James'; Rollback to s2; UPDATE new_emp set name = 'James' WHERE employee_id =180; Rollback; At the end of this transaction, what is true?()AYou have no rows in the table.BYou have an employee with the name of James.CYou cannot roll back to the same savepoint more than once.DYour last update fails to update any rows because employee ID 180 was already deleted.

单选题1. import java.util.*;  2. public class Example {  3. public static void main(String[] args) {  4. // insert code here  5. set.add(new integer(2));  6. set.add(new integer(l));  7. System.out.println(set);  8. }  9. }  Which code, inserted at line 4, guarantees that this program will output [1,2]? ()A Set set = new TreeSet();B Set set = new HashSet();C Set set = new SortedSet();D List set = new SortedList();E Set set = new LinkedHashSet();

判断题Dim arrInt()as Integer=New Integer(3){0,1,2}A对B错

单选题1. import java.util.*;  2. class AddStuff {  3. public static void main(String [] args) {  4. TreeSet〈String〉 s = new TreeSet〈String〉();  5. s.add("one");  6. s.add("two");  7. // insert code here  8. for(String s2 : sorted)  9. System.out.print(s2 + " ");  10. }  11. }  和四个代码片段:  s1. SortedSet sorted = s.tailSet(s.first());  s2. SortedSet〈String〉 sorted = s.tailSet(s.first());  s3. SortedSet sorted = (SortedSet)s.tailSet(s.first());  s4. SortedSet sorted = (SortedSet〈String〉)s.tailSet(s.first());  分别插入到第7行,哪项可以编译?()As1Bs2Cs2 和 s3Ds2 和 s4

单选题针对Set s接口,下列哪项是正确的?()A s.add(2)B s.add(new Integer(2))C s.add(“2”)D s.add(new java.util.Date())

判断题Dim arrInt()as Integer=New Integer(2){}A对B错

单选题现有:  1.  import java.util.*;      2.  class AddStuff  {  3.public static void main (String  []  args)    {      4.TreeSet  s= new TreeSet();      5.    s.add( "one"):      6.    s.add( "two"):  7.    //insert code here      8.for (String s2:  sorted)      9.System.out.print (s2+" ");      10.    }     11.  }  和四个代码片段:  s1.sortedSet  sorted=s.tailSet(s.first());  s2.sortedSet  sorted=s.tailSet(s.first());  s3.sortedSet  sorted=  (SortedSet)s .tailSet(s.first());  s4.SortedSet  sorted=  (SortSet)s .tailSet(s.first()); 分别插入到第7行,哪项可以编译?()As2BslCs2和s3Ds2和s4Es2, s3和s4Fsl. s2. s3和s4

单选题Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE You issue these statements: CREATE table new_emp ( employe_id NUMBER, name VARCGAR2(30)); INSERT INTO new_emp SELECT employee_id, last_name from employees; Savepoint s1; UPDATE new_emp set name = UPPER(name); Savepoint s2; Delete from new_emp; Rollback to s2; Delete from new_emp where employee_id=180; UPDATE new_emp set name = 'James'; Rollback to s2; UPDATE new_emp sey name = 'James' Where employee_id=180; Rollback; At the end of this transaction, what is true? ()AYou have no rows in the table.BYou have an employee with the name of James.CYou cannot roll back to the same savepoint more than once.DYour last update fails to update any rows because employee ID 180 was already deleted.

判断题Dim arrInt()as Integer=New Integer(2){0,1,2}A对B错