Which is true? (Choose all that apply.)
A. "C extends I" is correct if and only if C is a class and I is an interface
B. "C extends I" is correct if and only if C is an interface and I is a class
C. "C extends I" is correct if C and I are either both classes or both interfaces
D. "C extends I" is correct for all combinations of C and I being classes and/or interfaces
DOWNLOAD the answer
This is your world! It's not just Java
Friday, September 30, 2011
Quiz of the day | OCPJP (25)
Posted by
Paiman
at
8:53 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Thursday, September 29, 2011
Quiz of the day | OCPJP (24)
3. public class J {
4. public static void main(String[] args) {
5. int j = 7;
6. assert(++j > 7);
7. assert(++j > 8): "Jakarta";
8. assert(j > 10): j=12;
9. assert(j==12): macet();
10. assert(j==12): new J();
11. }
12. static void macet() { }
13. }
Which are true? (Choose all that apply.)
A. Compilation succeeds
B. Compilation fails due to an error on line 6
C. Compilation fails due to an error on line 7
D. Compilation fails due to an error on line 8
E. Compilation fails due to an error on line 9
F. Compilation fails due to an error on line 10
DOWNLOAD the answer
4. public static void main(String[] args) {
5. int j = 7;
6. assert(++j > 7);
7. assert(++j > 8): "Jakarta";
8. assert(j > 10): j=12;
9. assert(j==12): macet();
10. assert(j==12): new J();
11. }
12. static void macet() { }
13. }
Which are true? (Choose all that apply.)
A. Compilation succeeds
B. Compilation fails due to an error on line 6
C. Compilation fails due to an error on line 7
D. Compilation fails due to an error on line 8
E. Compilation fails due to an error on line 9
F. Compilation fails due to an error on line 10
DOWNLOAD the answer
Posted by
Paiman
at
7:59 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Wednesday, September 28, 2011
Quiz of the day | OCPJP (23)
Given:
3. class A {
4. public void a() { System.out.print("A "); }
5. }
6. class B extends A {
7. public void b() { System.out.print("B "); }
8. public void a() { System.out.print("a "); }
9. }
10. public class C {
11. public static void main(String[] args) { new C().c(); }
12. void c() {
13. new B().a();
14. ((A) new B()).a();
15. ((A) new B()).b();
16. }
17. }
What is the result? (Choose all that apply.)
A. a a B
B. a A B
C. a a followed by an exception
D. a A followed by an exception
E. Compilation fails with an error at line 14
F. Compilation fails with an error at line 15
DOWNLOAD the answer
3. class A {
4. public void a() { System.out.print("A "); }
5. }
6. class B extends A {
7. public void b() { System.out.print("B "); }
8. public void a() { System.out.print("a "); }
9. }
10. public class C {
11. public static void main(String[] args) { new C().c(); }
12. void c() {
13. new B().a();
14. ((A) new B()).a();
15. ((A) new B()).b();
16. }
17. }
What is the result? (Choose all that apply.)
A. a a B
B. a A B
C. a a followed by an exception
D. a A followed by an exception
E. Compilation fails with an error at line 14
F. Compilation fails with an error at line 15
DOWNLOAD the answer
Posted by
Paiman
at
9:43 AM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Tuesday, September 27, 2011
Quiz of the day | OCPJP (22)
Given:
1. enum Menu {HOME, ABOUT, CONTACT};
2. public class Main {
3. public static void main(String[] args) {
4. Main m = new Main();
5. Menu[] v = Menu.values();
6. v = Menu.getValues();
7. for(Menu me: Menu.values()) m.getEnum(me);
8. for(int x = 0; x < Menu.values().length; x++) m.getEnum(v[x]);
9. for(int x = 0; x < Menu.length; x++) m.getEnum(v[x]);
10. for(Menu me: v) m.getEnum(me);
11. }
12. public void getEnum(Menu e) {
13. System.out.print(e + " ");
14. } }
Which line(s) of code will cause a compiler error? (Choose all that apply.)
A. line 1
B. line 5
C. line 6
D. line 7
E. line 8
F. line 9
G. line 10
H. line 12
DOWNLOAD the answer
1. enum Menu {HOME, ABOUT, CONTACT};
2. public class Main {
3. public static void main(String[] args) {
4. Main m = new Main();
5. Menu[] v = Menu.values();
6. v = Menu.getValues();
7. for(Menu me: Menu.values()) m.getEnum(me);
8. for(int x = 0; x < Menu.values().length; x++) m.getEnum(v[x]);
9. for(int x = 0; x < Menu.length; x++) m.getEnum(v[x]);
10. for(Menu me: v) m.getEnum(me);
11. }
12. public void getEnum(Menu e) {
13. System.out.print(e + " ");
14. } }
Which line(s) of code will cause a compiler error? (Choose all that apply.)
A. line 1
B. line 5
C. line 6
D. line 7
E. line 8
F. line 9
G. line 10
H. line 12
DOWNLOAD the answer
Posted by
Paiman
at
10:29 PM
0
comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels:
OCPJP
Monday, September 26, 2011
Quiz of the day | OCPJP (21)
Given:
3. public class Sep26 {
4. public static void main(String[] args) {
5. short f4 = 4;
6. new Sep26().go(f4);
7. new Sep26().go(new Integer(8));
8. }
9. void go(Short s) { System.out.print("S "); }
10. void go(Long l) { System.out.print("L "); }
11. void go(int i) { System.out.print("i "); }
12. void go(Number n) { System.out.print("N "); }
13. }
What is the result?
A. i L
B. i N
C. S L
D. S N
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
3. public class Sep26 {
4. public static void main(String[] args) {
5. short f4 = 4;
6. new Sep26().go(f4);
7. new Sep26().go(new Integer(8));
8. }
9. void go(Short s) { System.out.print("S "); }
10. void go(Long l) { System.out.print("L "); }
11. void go(int i) { System.out.print("i "); }
12. void go(Number n) { System.out.print("N "); }
13. }
What is the result?
A. i L
B. i N
C. S L
D. S N
E. Compilation fails.
F. An exception is thrown at runtime.
DOWNLOAD the answer
Posted by
Paiman
at
8:12 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.