Given:
2. import java.text.*;
3. import java.util.*;
4. public class DF {
5. public static void main(String[] args) {
6. DateFormat df1 = DateFormat.getInstance();
7. DateFormat df2 = DateFormat.getInstance(DateFormat.SHORT);
8. DateFormat df3 = DateFormat.getDateInstance(DateFormat.FULL);
9. DateFormat df4 = DateFormat.getDateInstance(DateFormat.EXTENDED);
10. } }
Which are true? (Choose all that apply.)
A. Line 2 is not necessary.
B. Line 3 is not necessary.
C. Compilation fails due to an error on line 6.
D. Compilation fails due to an error on line 7.
E. Compilation fails due to an error on line 8.
F. Compilation fails due to an error on line 9.
DOWNLOAD the answer
This is your world! It's not just Java
Wednesday, September 21, 2011
Quiz of the day | OCPJP (16)
Posted by
Paiman
at
8:24 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Tuesday, September 20, 2011
Quiz of the day | OCPJP (15)
Given:
2. public class X {
3. static int x = 1;
4. public static void main(String[] args) {
5. int x = 2;
6. for(int i=0; i< 3; i++) {
7. if(i==1) System.out.print(x + " ");
8. }
9. go();
10. System.out.print(x + " " + i);
11. }
12. static void go() { int x = 3; }
13. }
What is the result?
A. 1 2 2
B. 2 2 2
C. 2 2 3
D. 2 3 2
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
2. public class X {
3. static int x = 1;
4. public static void main(String[] args) {
5. int x = 2;
6. for(int i=0; i< 3; i++) {
7. if(i==1) System.out.print(x + " ");
8. }
9. go();
10. System.out.print(x + " " + i);
11. }
12. static void go() { int x = 3; }
13. }
What is the result?
A. 1 2 2
B. 2 2 2
C. 2 2 3
D. 2 3 2
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
Posted by
Paiman
at
11:33 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Monday, September 19, 2011
Quiz of the day | OCPJP (14)
1. import java.util.*;
2. public class BCA {
3. public static void main(String[] args) {
4. List desk = new ArrayList();
5. desk.add("b"); desk.add("c"); desk.add("a");
6. Collection.sort(desk);
7. System.out.print(desk.indexOf("b"));
8. Collection.reverse(desk);
9. System.out.print(" " + desk.indexOf("c"));
10. System.out.println(" " + desk.indexOf("a"));
11. } }
What is the result?
A. 1 2 0
B. 2 2 1
C. 2 0 2
D. 1 0 2
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
2. public class BCA {
3. public static void main(String[] args) {
4. List
5. desk.add("b"); desk.add("c"); desk.add("a");
6. Collection.sort(desk);
7. System.out.print(desk.indexOf("b"));
8. Collection.reverse(desk);
9. System.out.print(" " + desk.indexOf("c"));
10. System.out.println(" " + desk.indexOf("a"));
11. } }
What is the result?
A. 1 2 0
B. 2 2 1
C. 2 0 2
D. 1 0 2
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
Posted by
Paiman
at
8:08 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Sunday, September 18, 2011
Quiz of the day | OCPJP (13)
2. class Parent {
3. static String parent = "";
4. void doStuff() { parent += "parent "; }
5. }
6. public class Child extends Parent {
7. public static void main(String[] args) {
8. new Child().go();
9. }
10. void go() {
11. Parent p = new Child();
12. Child c = (Child)p;
13. // insert code here
14. }
15. void doStuff() { parent += "child "; }
16. }
If the rest of the code compiles, which line(s) of code, inserted independently at line 13, compile? (Choose all that apply.)
A. c.doStuff();
B. p.doStuff();
C. this.doStuff();
D. super.doStuff();
E. c.super.doStuff();
F. p.super.doStuff();
G. this.super.doStuff();
H. There are other errors in the code.
DOWNLOAD the answer
3. static String parent = "";
4. void doStuff() { parent += "parent "; }
5. }
6. public class Child extends Parent {
7. public static void main(String[] args) {
8. new Child().go();
9. }
10. void go() {
11. Parent p = new Child();
12. Child c = (Child)p;
13. // insert code here
14. }
15. void doStuff() { parent += "child "; }
16. }
If the rest of the code compiles, which line(s) of code, inserted independently at line 13, compile? (Choose all that apply.)
A. c.doStuff();
B. p.doStuff();
C. this.doStuff();
D. super.doStuff();
E. c.super.doStuff();
F. p.super.doStuff();
G. this.super.doStuff();
H. There are other errors in the code.
DOWNLOAD the answer
Posted by
Paiman
at
12:15 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Saturday, September 17, 2011
Quiz of the day | OCPJP (12)
3. public class C {
4. public static void main(String[] c) {
5. int i = 23;
6. Integer i2;
7. Integer i3;
8. i2 = i.intValue();
9. i3 = i.valueOf(23);
10. System.out.println((i == i2) + " " + (i == i3));
11. } }
What is the result?
A. true true
B. true false
C. false true
D. false false
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
4. public static void main(String[] c) {
5. int i = 23;
6. Integer i2;
7. Integer i3;
8. i2 = i.intValue();
9. i3 = i.valueOf(23);
10. System.out.println((i == i2) + " " + (i == i3));
11. } }
What is the result?
A. true true
B. true false
C. false true
D. false false
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
Posted by
Paiman
at
8:52 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Leave a Message
Blog Archive
-
▼
2011
(40)
-
▼
October
(11)
- Quiz of the Day | OCPJP (35)
- Quiz of the day | OCPJP (34)
- Quiz of the day | OCPJP (33)
- Quiz of the day | OCPJP (32)
- Quiz of the day | OCPJP (31)
- Quiz of the day | OCPJP (30)
- Quiz of the day | OCPJP (29)
- Quiz of the day | OCPJP (28)
- Quiz of the day | OCPJP (27)
- Quiz of the day | OCPJP (26)
- Quiz of the day | OCPJP (22)
-
▼
October
(11)
Labels
- About Java (2)
- Ajax (1)
- Animation (1)
- Array (1)
- BufferedReader (1)
- C# (1)
- C++ (1)
- Certification (5)
- Cryptography (1)
- Download (37)
- Eclipse (1)
- EJB (2)
- Game (3)
- Hibernate (3)
- Input Data (2)
- J2ME (1)
- Java 2D (1)
- Java 3D (1)
- Java Advance (1)
- Java Basic (6)
- Java Networking (1)
- Java RMI (1)
- Java Secrets (1)
- Java Swing (3)
- Java Thread (2)
- Java Tutorial (4)
- JavaFX (3)
- JDBC (1)
- JMS (1)
- JSP (1)
- Linux (1)
- MySQL (1)
- OCPJP (34)
- Opinion (2)
- Oracle (1)
- PHP (1)
- Scanner (1)
- SCJP (1)
- SCWCD (1)
- Silverlight (1)
- Spring (1)
- Tutorial (2)
- Web Service (1)
- Wireless (1)
Powered by Blogger.