Vladimir Popel

Greenhorn
+ Follow
since Jan 20, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vladimir Popel

Sorry for my delayed answer

I prepared for the exam about 2-3 hours/day for 6 months.

As preparation materials I've used:
- K&B book
- Khalid Mughal book
- the online mocks listed on javaranch.com
- Whizlabs simulators for java 1.4 and 1.5
- Enthuware simulators for java 1.4

Tips:
- during you preparation for the exam, build a list with all the issues that you consider tricky and, very important, review them before the exam day
- bookmark the mock questions that you get wrong and, very important, review them before the exam day
- use notes (find the links to them on javaranch.com) and use the ones that you consider better organized especially for IO, String/StrigBuffer, Collections etc., and review them before the exam
- take 2 weeks before the exam and only take mocks and review your material (notes, chapter summaries in K&B book, etc.)
- take the mock exams in conditions as closely as possible as the real exam (nr. of questions, time allowed, etc.)
- during the exam, if you don't know the answer move to the next question and review the unanswered question at the end

All those above helped me to get the exam with a satisfactory score

I wish you success with you preparation / exam
[ November 25, 2008: Message edited by: Cristian Popescu ]
16 years ago
SCWCD
I've already started to get a taste of it
16 years ago
Thanks to all the ranchers for their help

Anyone who wants to ask about my SCJP experience please don't hesitate

Regards, Cristian.
16 years ago
Here is the code:

=======================

class TestClass {

int i = getInt();

{
System.out.println(i); // no error, var i known
j = 20; // no error
System.out.println(j); // error here, forward ref to j
}

int j;

int getInt() {
System.out.println(j); // no error here!!!
return 10;
}
}

===========================

Can someone please explain why in an instance initializer you can assign a forward referenced variable but you can't use it (print it for example)?

I seems that in a method you can both assign and use a forward referenced variable...

What's the rule for this behavior?

Thanks in advance
Can someone please post a good resource (link, book title, etc.) for OO concepts?

I hear a lot of people complaining about low score on this objective and I think many SCJP prospects will appreciate the help on this one.

Thank you

PS: I first asked this question in the SCJP results forum but I think its place should be here
Can someone please post a good resource (link, book title, etc.) for OO concepts?

I hear a lot of people complaining about low score on this objective and I think many SCJP prospects will appreciate the help on this one.

Thank you
16 years ago
Does anyone know where can I find the following mock exam: Jamie Jaworski's Certification Exam Preparation? The link provided in the mock exams section of Javaranch is no good.

Thank you in advance
Can someone please provide a good explanation for the following question?

Here is the original question and answer:

=========================================
Question 7. Select two correct statements about the code given below:

class A{}
class B extends A implements E{}//line 1
class C extends A{}
class D extends B{}
interface E{}
public class Question07 {
public static void main(String[] args) {
A a = new D();//line 2
C c = new C();//line 3
E e = (E)a;//line 4
B b = (B)e;//line 5
}
}



A. The code compiles without error and runs fine.
B. Compilation error on line 1 because interface E is not yet declared (forward-referencing).
C. Compilation error on line 4 because class A doesn't implement interface E.
D. The cast on line 4 is mandatory.
E. The cast on line 5 is not mandatory.

------------------------
Correct answer: A D
Comments:
Relevant sections of the JLS:
8.1.3 Superclasses and Subclasses
8.1.4 Superinterfaces
5.5 Casting Conversion
5.1.5 Narrowing Reference Conversions
15.16 Cast Expressions

First, pay attention to the class hierarchy (B and C are sibling classes!!) Then, there is no such thing as forward-referencing issues when using interfaces declared later in the compilation unit. On line 4, we are dealing with an object whose runtime type is D which implements interface E. The cast is mandatory, though, since the reference type (A) is not assignment compatible with the reference type E. The cast on line 5 is mandatory for the same reasons.

=========================================

Now here is what I'm asking:

My concern is for line 4. I know that casts are subject to both a compile-time check (the compiler checks if the reference types belong to the same hierarchy of classes) and a runtime check (when the actual objects pointed at are compared for assignment compatibility).

I've compiled the code and it runs. How can line 4 pass the compiler's check when class A and interface E don't belong to the same hierarchy of classes? I think I'm missing something

Thanks in advance