Riza Aktunc

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

Recent posts by Riza Aktunc

Jeffrey Tian wrote:Congratulations!

What do you think of Whizlab and ExamLab tests? Are they easier or more difficult than the real exam? How much do you score on these mock tests?
Thanks.



Personally, they are harder than the real exam. I scored around 75-80 percent on Whizlab and 55-65 percent on ExamLab.
12 years ago
Thank you all fellas!

maganti suryanarayana wrote:Congrats. Even i want to write for SCJP. Can you send any notes which you have prepared i.e., pdfs, word documents, notepads etc
Please help me. Even i am reading SCJP by kathy sierra



maganti, I have my notes as hardcopy and it is just a few pages. There are a lot of study material on this forum, blogs, wikis etc.

I have used them to study and it was quite enough so that I didn't need to keep notes after all. Just a little bit search on this forum you can also find a lot of material.

Tip: Check the signatures of the posts, then you can find links
12 years ago
I have passed the OCPJP exam yesterday with the score of 93%. I want to clear some doubts on the exam. First of all, there were no drag and drop questions. Morover, there were no serialization related question.

I read the K&B book. Then, I solved the Whizlab and ExamLab tests.

And most importantly check the answers of these tests and pay really good attention to the answers of the questions that I had done wrong.

Last two days, I have tried to review all the two minute drills and some of the chapters in K&B book.

Through all these preparation prosess, I follow the forum as much as I can.

Thanks to Kathy & Bert for their marvelous book. Personally, it is more of a fairytale than a book

Thanks to all of you for your help to make things clearer.

Take this as a token of my gratitude for all your help.
12 years ago
If anyone took the exam recently, could you please clarify my confusions:

There are questions about
1) Formatter class
2) Serializable
3) ConcurrentSkipListMap
4) Drag and Drops
on whizlab.

Are all these also included in the exam. If not, do you think scoring 70-80 on Whizlab practice tests is enough on these conditions?
Welcome Ashish,

Congratulations on your new book. I hope it will attract lots of attention.

Best Regards,
Riza Aktunc
12 years ago
Actually if you make a little bit change in Eli's code you can achieve what you want to see. You can see the necessary changes below:

private static SimpleSingleton theInstance = new SimpleSingleton(); to public static SimpleSingleton theInstance = new SimpleSingleton();
SimpleSingleton s1 = SimpleSingleton.getInstance(); to SimpleSingleton s1 = SimpleSingleton.theInstance;

This is what you want to see; but not a good implementation regarding encapsulation issues!

I was writing this post but obviously Eli made it quicker than me
As explained in here : http://download.oracle.com/javase/1.4.2/docs/api/java/util/Calendar.html#getInstance%28java.util.Locale%29 ; getInstance(loc) just gets the time of the given locale not the language.

If you want to print the date in Italian, you need to use DateFormat class.
A map has two attributes - key and value.
Judging by what you have posted; a map can contain itself as a value but not a key.

String x="";
HashMap hm=new HashMap();
hm.put(hm,x); //not ok
hm.put(x,hm); //ok

But, when I try it, compiler does not complain! In runtime hm.put(hm,x); gives StackOverFlowError!

Nitesh Nandwana wrote:i thought about need of HAS-A relationship is only one that is, to allow more specialist classes usage hence reduction in code else i could directly write show() in Car class.



Sometimes, the subclass directly uses the method of the superclass without overriding it.
Think about a Rectangle and Shape classes. Rectangle do not need to override getColor() and setColor() methods of Shape class, instead just extends the Shape class. Moreover, it can directly access Shape class'es instance variables such as Color.
If you use HAS-A instead of IS-A, you cannot use polymorphism,either.

My point is that IS-A is not redundant and it indeed reduces the code size and enable code reusability. In fact, almost all object oriented design paterns include IS-A relationship.
When a constructor is called, on the first line super() is called implicitly. There is just one exception. If the first line is this(...) or super(...), then super() is not called. Considering this information:

In main the constructor of C is called.
From C's constructor, B's constructor is called.
From B's constructor, A() is called.
From A(), A("d") is called.
A("d") makes s="-d"
A() makes s="-da"
B() makes s="-dab"
C() makes s="-dabc"
main prints "-dabc"
I am interested. I have reserved my exam on 17th October. However I am talking about OCPJP, not OCJP if there is any difference.
It helps to resolve a part of my confusion. I have still a little left.

http://download.oracle.com/javase/1.4.2/docs/api/java/util/Calendar.html here the api documentation of Calendar class says that Calendar has 2 constructors.

What are these constructors for? Can an abstract class have constructors? If it can, what is the point?
I know that abstract classes can't be instantiated. So, how come "public abstract class Calendar" has a constructor and get instantiated when its getInstance() method is called?

Ananya Raval wrote:

Yes that is true. And this is why you see the same thread 3 times in the output instead of thread names mixed with each other. Try to remove the synchronize keyword and then see the output...



Even if you remove the synchronized keyword from the method, the output is the same. i.e. same thread name 3 times and then another..like--

run:
Thread-0
Thread-0
Thread-0
Thread-2
Thread-2
Thread-2
Thread-1
Thread-1
Thread-1
Thread-3
Thread-3
Thread-3
BUILD SUCCESSFUL (total time: 1 second)

There is no difference if synchronized keyword is removed(except of the order of the Threads executing).




This is just by chance, try increasing for loop iteration to 100 and see the mixed result.