Tìm kiếm:
TRANG NHÀ
Giới thiệu VNEDU.ORG
Điều khoản và bản quyền
Liên lạc VNEDU
TRẮC NGHIỆM TRỰC TUYẾN
---Công Cụ:---
Soạn Biểu thức
Bảng màu HTML
Ký hiệu đặc biệt 01
Ký hiệu đặc biệt 02
Ký hiệu đặc biệt 03
Ký hiệu đặc biệt 04
Ký hiệu đặc biệt 05
Ký hiệu đặc biệt 06
Ký hiệu đặc biệt 07
Ký hiệu đặc biệt [Toán]
55 bài trong 6 trang (10 bài/trang) và bạn đang ở trang 2.
Demo

What will be the output of the program? public class Test { public static void main (String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println("baz = " + baz); /* Line 8 */ } } And the command line invocation: > java Test red green blue A. baz = B. baz = null C. baz = blue D. Runtime Exception........ What will be the output of the program? class Happy extends Thread { final StringBuffer sb1 = new StringBuffer(); final StringBuffer sb2 = new StringBuffer(); public static void main(String args[]) { final Happy h = new Happy(); new Thread() { public void run() ........

Demo

Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class? A. final B. static C. private D. protected...... interface DoMath { double getArea(int rad); } interface MathPlus { double getVol(int b, int h); } /* Missing Statements ? */ which two code fragments inserted at end of the program, will allow to compile? class AllMath extends DoMath { double getArea(int r); } interface AllMath implements MathPlus { double getVol(int x, int y); }..........

Demo

import java.io.*; public class MyProgram { public static void main(String args[]) { FileOutputStream out = null; try { out = new FileOutputStream("test.txt"); out.write(122); } catch(IOException io) { System.out.println("IO Error."); } finally { out.close(); } } } and given that all methods of class FileOutputStream, including close(), throw an IOException, which of these is true? A. This program will compile successfully. B. This program fails to compile due to an error at line 4. C. This program fails to compile due to an error at line 6. D. This program fails to compile due to an error at line 13...........

Demo

You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective? A. public B. private C. protected D. transient... interface Base { boolean m1 (); byte m2(short s); } which two code fragments will compile? interface Base2 implements Base {} abstract class Class2 extends Base { public boolean m1(){ return true; }} abstract class Class2 implements Base {} abstract class Class2 implements Base { public boolean m1(){ return (7 > 4); }} abstract class Class2 implements Base .........

Demo

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.... /* Missing Statement ? */ public class foo { public static void main(String[]args)throws Exception { java.io.PrintWriter out = new java.io.PrintWriter(); new java.io.OutputStreamWriter(System.out,true); out.println("Hello"); } } What line of code should replace the missing statement to make this program compile? A. No statement required. B. import java.io.*;.........

Demo

public class Test { } What is the prototype of the default constructor? A. Test( ) B. Test(void) C. public Test( ) D. public Test(void)....... What is the narrowest valid returnType for methodA in line 3? public class ReturnIt { returnType methodA(byte x, double y) /* Line 3 */ { return (long)x / y * 2; } } A. int B. byte C. long D. double........

Demo

What will be the output of the program? try { int x = 0; int y = 5 / x; } catch (Exception e) { System.out.println("Exception"); } catch (ArithmeticException ae) { System.out.println(" Arithmetic Exception"); } System.out.println("finished"); A. finished B. Exception C. Compilation fails. D. Arithmetic Exception...........

Demo

Which of the following class level (nonlocal) variable declarations will not compile? A. protected int a; B. transient int b = 3; C. private synchronized int e; D. volatile int d;....... What will be the output of the program? public class ArrayTest { public static void main(String[ ] args) { float f1[ ], f2[ ]; f1 = new float[10]; f2 = f1; System.out.println("f2[0] = " + f2[0]); } } A. It prints f2[0] = 0.0 B. It prints f2[0] = NaN....

Demo

What will be the output of the program? class MyThread extends Thread { public static void main(String [] args) { MyThread t = new MyThread(); t.start(); System.out.print("one. "); t.start(); System.out.print("two. "); } public void run() { System.out.print("Thread "); } } A. Compilation fails B. An exception occurs at runtime. C. It prints "Thread one. Thread two." D. The output cannot be determined..........

Demo

What will be the output of the program? class A { final public int GetResult(int a, int b) { return 0; } } class B extends A { public int GetResult(int a, int b) {return 1; } } public class Test { public static void main(String args[]) { B b = new B(); System.out.println("x = " + b.GetResult(0, 1)); } } A. x = 0 B. x = 1 C. Compilation fails. D. An exception is thrown at runtime........

    Đến trang:   Left    1    3    4    5    6    Right  
Thống kê:
Phát triển hệ thống: TRƯƠNG HỮU ĐỨC - Phiên bản 3.0 - © Copyright 2013 - 2024 - VNEDU.ORG

free counters