3. class P {
4. P play() { System.out.print("p "); return new P(); }
5. P play(int x) { System.out.print("p x "); return new P(); }
6. }
7. class Q extends P {
8. Q play() { System.out.print("q "); return new Q(); }
9. P play(int x) { System.out.print("r "); return new P(); }
10.
11. public static void main(String[] args) {
12. new Q().play();
13. new Q().play(7);
14. super.play(7);
15. new P().play();
16. P s = new Q();
17. s.play();
18. } }
What is the result?
A. q r r p p
B. q r p x p r
C. q r p x p q
D. Compilation fails due to a single error.
E. Compilation fails due to errors on more than one line.
DOWNLOAD the answer
This is your world! It's not just Java
Friday, September 16, 2011
Quiz of the day | OCPJP (11)
Posted by
Paiman
at
9:46 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Thursday, September 15, 2011
Quiz of the day | OCPJP (10)
2. interface A { }
3. interface B { }
4. abstract interface C extends A, B {
5. void c();
6. }
7. class D implements C {
8. public void c() { System.out.print("c "); }
9. }
10. class E implements C extends D {
11. public void c() { System.out.print("c x "); }
12. }
13. public class F extends D implements C, B { }
What is the result? (Choose all that apply.)
A. Compilation succeeds.
B. Compilation fails because of error(s) in C.
C. Compilation fails because of error(s) in D.
D. Compilation fails because of error(s) in E.
E. Compilation fails because of error(s) in F.
DOWNLOAD the answer
3. interface B { }
4. abstract interface C extends A, B {
5. void c();
6. }
7. class D implements C {
8. public void c() { System.out.print("c "); }
9. }
10. class E implements C extends D {
11. public void c() { System.out.print("c x "); }
12. }
13. public class F extends D implements C, B { }
What is the result? (Choose all that apply.)
A. Compilation succeeds.
B. Compilation fails because of error(s) in C.
C. Compilation fails because of error(s) in D.
D. Compilation fails because of error(s) in E.
E. Compilation fails because of error(s) in F.
DOWNLOAD the answer
Posted by
Paiman
at
11:34 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Wednesday, September 14, 2011
Quiz of the day | OCPJP (9)
Which are true about a method-local inner class? (Choose all that apply.)
A. It must be marked final
B. It can be marked abstract
C. It can be marked public
D. It can be marked static
E. It can access private members of the enclosing class
DOWNLOAD the answer
A. It must be marked final
B. It can be marked abstract
C. It can be marked public
D. It can be marked static
E. It can access private members of the enclosing class
DOWNLOAD the answer
Posted by
Paiman
at
11:01 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Tuesday, September 13, 2011
Quiz of the day | OCPJP (8)
Given:
1. public class MyOffice {
2. public static void main(String[] args) {
3. String name = "PT";
4. name.concat("Time");
5. name = go(name);
6. System.out.println(name);
7. }
8. static String go(String name) {
9. name.concat("Excelindo");
10. return name;
11. } }
What is the result?
A. Time
B. PT
C. TimeExcelindo
D. PTTime
E. PTExcelindo
F. PTTimeExcelindo
G. Compilation fails.
DOWNLOAD the answer
1. public class MyOffice {
2. public static void main(String[] args) {
3. String name = "PT";
4. name.concat("Time");
5. name = go(name);
6. System.out.println(name);
7. }
8. static String go(String name) {
9. name.concat("Excelindo");
10. return name;
11. } }
What is the result?
A. Time
B. PT
C. TimeExcelindo
D. PTTime
E. PTExcelindo
F. PTTimeExcelindo
G. Compilation fails.
DOWNLOAD the answer
Posted by
Paiman
at
8:31 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Monday, September 12, 2011
Quiz of the day | OCPJP (7)
Given:
public class TimeExcelindo extends Thread {
public static void main(String[] args) {
Thread t = new Thread(new TimeExcelindo());
Thread t2 = new Thread(new TimeExcelindo());
t.start();
t2.start();
}
public static void run() {
for(int i = 0; i < 2; i++)
System.out.print(Thread.currentThread().getName() + " ");
}
}
Which are true? (Choose all that apply.)
A. Compilation fails.
B. No output is produced.
C. The output could be Thread-1 Thread-3 Thread-1 Thread-2
D. The output could be Thread-1 Thread-3 Thread-1 Thread-3
E. The output could be Thread-1 Thread-1 Thread-2 Thread-2
F. The output could be Thread-1 Thread-3 Thread-3 Thread-1
G. The output could be Thread-1 Thread-3 Thread-1 Thread-1
DOWNLOAD the answer
public class TimeExcelindo extends Thread {
public static void main(String[] args) {
Thread t = new Thread(new TimeExcelindo());
Thread t2 = new Thread(new TimeExcelindo());
t.start();
t2.start();
}
public static void run() {
for(int i = 0; i < 2; i++)
System.out.print(Thread.currentThread().getName() + " ");
}
}
Which are true? (Choose all that apply.)
A. Compilation fails.
B. No output is produced.
C. The output could be Thread-1 Thread-3 Thread-1 Thread-2
D. The output could be Thread-1 Thread-3 Thread-1 Thread-3
E. The output could be Thread-1 Thread-1 Thread-2 Thread-2
F. The output could be Thread-1 Thread-3 Thread-3 Thread-1
G. The output could be Thread-1 Thread-3 Thread-1 Thread-1
DOWNLOAD the answer
Posted by
Paiman
at
9:01 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.