Tin Học >> Lập trình >> Java
|| C#
C++
Visual Basic
Visual Foxpro
C
Java
Pascal
Thiết Kế Web
ASP.NET
XML
CSS
PHP
Có 55 bài trong 6 trang (10 bài/trang) và bạn đang ở trang 4.
What is the name of the method used to start a thread execution? A. init(); B. start(); C. run(); D. resume();.... Which two are valid constructors for Thread? Thread(Runnable r, String name) Thread() Thread(int priority) Thread(Runnable r, ThreadGroup g) Thread(Runnable r, int priority) A. 1 and 3 B. 2 and 4 C. 1 and 2 D. 2 and 5...... Which is true about an anonymous inner class? A. It can extend exactly one class and implement exactly one interface. B. It can extend exactly one class and can implement multiple interfaces. C. It can extend exactly one class or implement exactly one interface. D. It can implement multiple interfaces regardless of whether it also extends a class...... which one create an anonymous inner class from within class Bar? A. Boo f = new Boo(24) { }; B. Boo f = new Bar() { }; C. Bar f = new Boo(String s) { }; D. Boo f = new Boo.Bar(String s) { };....... Which statement is true for the class java.util.HashSet? A. The elements in the collection are ordered. B. The collection is guaranteed to be immutable. C. The elements in the collection are guaranteed to be unique. D. The elements in the collection are accessed using a unique key....... Which of the following statements about the hashcode() method are incorrect? The value returned by hashcode() is used in some collection classes to help locate objects. The hashcode() method is required to return a positive int value. The hashcode() method in the String class is the one inherited from Object. ..... Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization? A. java.util.SortedMap B. java.util.TreeMap C. java.util.TreeSet D. java.util.Hashtable........ What will be the output of the program? public class Test { private static float[] f = new float[2]; public static void main (String[] args) { System.out.println("f[0] = " + f[0]); } } A. f[0] = 0 B. f[0] = 0.0 C. Compile Error D. Runtime Exception........ Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized? A. java.util.HashSet B. java.util.LinkedHashSet C. java.util.List D. java.util.ArrayList......... You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be accessed in natural order. Which interface provides that capability? A. java.util.Map B. java.util.Set C. java.util.List D. java.util.Collection....... What will be the output of the program? class Exc0 extends Exception { } class Exc1 extends Exc0 { } /* Line 2 */ public class Test { public static void main(String args[]) { try { throw new Exc1(); /* Line 9 */ } catch (Exc0 e0) /* Line 11 */ { System.out.println("Ex0 caught"); } catch (Exception e) { System.out.println("exception caught"); } } } A. Ex0 caught B. exception caught C. Compilation fails because of an error at line 2. D. Compilation fails because of an error at line 9...... What will be the output of the program? int I = 0; label: if (I < 2) { System.out.print("I is " + I); I++; continue label; } A. I is 0 B. I is 0 I is 1 C. Compilation fails. D. None of the above...... What will be the output of the program? public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( "Finally" ); } } } A. Finally B. Compilation fails. C. The code runs with no output. D. An exception is thrown at runtime........ What will be the output of the program? for (int i = 0; i < 4; i += 2) { System.out.print(i + " "); } System.out.println(i); /* Line 5 */ A. 0 2 4 B. 0 2 4 5 C. 0 1 2 3 4 D. Compilation fails........ What will be the output of the program? int x = 3; int y = 1; if (x = y) /* Line 3 */ { System.out.println("x =" + x); } A. x = 1 B. x = 3 C. Compilation fails. D. The code runs with no output....... What will be the output of the program? int i = l, j = -1; switch (i) { case 0, 1: j = 1; /* Line 4 */ case 2: j = 2; default: j = 0; } System.out.println("j = " + j); A. j = -1 B. j = 0 C. j = 1 D. Compilation fails....... What will be the output of the program? int i = 1, j = 10; do { if(i > j) { break; } j--; } while (++i < 5); System.out.println("i = " + i + " and j = " + j); ..... import java.awt.*; class Ticker extends Component { public static void main (String [] args) { Ticker t = new Ticker(); /* Missing Statements ? */ } } which two of the following statements, inserted independently, could legally be inserted into missing section of this code? boolean test = (Component instanceof t); boolean test = (t instanceof Ticker); boolean test = t.instanceof(Ticker); boolean test = (t instanceof Component); A. 1 and 4 B. 2 and 3 C. 1 and 3 D. 2 and 4...... |