Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Varnam Aayiram

Ranch Hand
+ Follow
since Dec 23, 2008
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 Varnam Aayiram

Hi Folks...

I was wondering if in order to do well in this particular objective (obj 3.2), is it essential to commit to memory the table 6.1 that is found in chapter 6 ,page 450 of Kathy Sierra's SCJP6 Study guide?

Thanks.
Hi Folks,

I have difficulty understanding the result from this code:



If this were to be my invocation:
"\d\w" "ab456"
I get 2 45 as the result, why is 6 omitted?


If this were to be my invocation:
"\d\w" "ab45Kite"
I get 2 45 as the result, I was hoping Kite would be part of the result cos of 'w'.

Hope someone can shed some light on this. Thanks.
6 years ago
Thanks Jelle Klap
6 years ago
Hi Folks,

I have a regex related question:

Following is the code:



following is the invocation:

% java Regex "a?" "aba"




and the following is the output:

Pattern is a?
0 a
1
2 a
3


How is 3 even possible? I thought the index should read as ("0,1,2"). Hope someone can advise. Thanks.
6 years ago
Hi Folks,

Since abstract classes cannot be instantiated in java, I understand that the following code will not work:


However I noticed that the follwing code works fine, as in there is no compilation error:



I don't understand why. When we use the 'new' operator, are we not creating a new instance of the class, which in this case is not possible since 'DateFormat' is an abstract class? Yet the 2nd line of code works. Will be great if somone is able to explain. Thanks in advance.
6 years ago
Hi Folks,

I was looking through the following websites:

Self Study Training
http://www.whizlabs.com/scjp/online-training.html

Exam Simulator
http://www.whizlabs.com/scjp/mock-exam.html

I am wondering if the 'Self Study Training' encompases the 'Exam Simulator'. Does anyone have any idea?
Congrats O. Ziggy!!, wishing you many more success...
Hi Guys,

I was tring out some code from the Sera Bates SCJP 6 book. I have some difficulty understanding how the code works or why it works in that way. Do have a look at the code:



The out put for this code is :
{a=ant, d=dog, h=horse} {d=dog}

I don't understand the contents of the second curly brace {d=dog}. If I am not wrong, this is coming from the submap, but didnt the sub map just do a ("b", "g")??? I hope somone can help explain. Thanks.
Noted. Thanks guys, much appreciated.
6 years ago
Hi folks...

I was testing out a code sample from a book for the topic of 'HashMaps'. Here is the code:



The output as mentioned in the book should be:


wuth : Wuthering Heights
mbdk : Moby Dick
wooz : Wizard of Oz



What I am getting however is


mbdk : Moby Dick
wuth : Wuthering Heights
wooz : Wizard of Oz



I am not able to understand the change in order, hope somebody can help. Thanks.

6 years ago
Hi Cray Bil,

Why do you say there is no serilization in OCPJP? If I am not wrong exam objective 3.3 is as follow:

Noted. Yes it works. Thanks.
6 years ago
Hi Folks...

The following is the class body I am working on:



I need to write code in the main method that will use the displayMultiple method. My question is, is there any way to access the displayMultiple method from the main method, without declaring displayMultiple as a static method? Hope somone can advise. Thanks.
6 years ago

Ernest Friedman-Hill wrote:

Varnam Aayiram wrote:

I thought displayable.getDisplayText(); in DislayableTestApp.java would have got the job done, but it hasnt. I am not sure what I am missing. I hope someone can point me in the right direction. Thanks.



Calling the method retrieves the String, but you don't do anything with it -- it's as if you were handed the String and you took it and dropped it on the floor without looking at it. If you want to (for example) print it to the screen, then you have to go ahead and do that:



Yes Ernest Friedman..I should have thought about that, thanks for pointing it out.
6 years ago
Hi Folks…

I was trying out an exercise and ran into some difficulty. I need to use the getDisplayText method of the Displayable interface to display the employee information in the console. Some sample code is there and I have to modify it. This is how things are after I added my own code.


Interface: Displayable


Class: Employee



DisplayableTestApp


I thought displayable.getDisplayText(); in DislayableTestApp.java would have got the job done, but it hasnt. I am not sure what I am missing. I hope someone can point me in the right direction. Thanks.
6 years ago