jammy ponkia

Greenhorn
+ Follow
since Mar 23, 2008
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 jammy ponkia

Hi All,

Can anyone please help me out?

Thanks,
Jaimesh.
Hi Ranchers,

I am having my SCJP 1.5 exam in the next week.

I am really tensed whether i would be able to clear the exam or not?

I have practiced Whilabs questions also.Is doing whizlabs helpful or not?

Also, there are not many mock exams for 1.5.Most of them available are for 1.4 in Javaranch FAQ.

I am not getting the confidence to face the exam.Someone please guide me.

Hoping for a positive reply.


Thanks,
Jaimesh.
This question is from one of the SCJP mock exams provided by Technopark.

Thanks,
Jaimesh.
Hi All,

I am really confused with ==, Equals and Hashcodes.
Can anyone please explain me the below question?

Q)Your program has two object references, x and y. In some method the following logical tests are done:


boolean hashFlag = ( x.hashCode() == y.hashCode() );
boolean equalsFlag = x.equals( y );
boolean eqFlag = ( x == y );


Which of the following statements about the relationship between these tests are true.

(1)If equalsFlag is true, then hashFlag must be true
(2)If hashFlag is true, then eqFlag must be true
(3)If equalsFlag is false, then eqFlag must be false
(4)if hashFlag is false, then eqFlag must be false

Ans:1,3 and 4.

Thanks,
Jaimesh.
Hi All,

I am unable to access Barry Boone's Mock Exam link which is in
FAQ for SCJP Mocktests.

Is there an alternative to the link?

Please let me know.

Thanks,
Jaimesh.
Hi All,

Can you explain me the below code:

Byte b1 = new Byte("127");

if(b1.toString() == b1.toString())
System.out.println("True");
else
System.out.println("False");

Why does this print false?

Thanks,
Jaimesh.
Hi ,

I was planning to get Whizlabs or UCertify.

I am really confused as to which one should i purchase.

Which would be the best one to purchase in the order of preference?

Please suggest.


Thanks,
Jaimesh.
Hi Ranchers,

Please suggest me on something.

Regards,
Jaimesh.
Hi All,

Can anyone please let me know what are the mock exams that one can buy and practice for SCJP 1.5.

Buying Whizlabs is sufficient or do i have to purchase UCertify also?

Also, in SCJP FAQ MOCK EXAMS link, most of the questions available are for 1.4.There are very few which are available only for 1.5.

Are there any other links where i can get some questions for SCJP 1.5.

Please assist me.

Thanks & Regards,
Jaimesh.
Hi Sandeep,

I know that == checks whether the references are same. I have one more doubt.

why doesnt the below code print "Not Equal".

if( "STRING".toUpperCase() == "STRING".toUpperCase())
System.out.println("Equal");
else

System.out.println("Not Equal");

Thanks,
Jaimesh.
Hi All,

Can anyone explain why the below code prints "Not Equal"?

if("String".replace('g','G') == "String".replace('g','G'))
System.out.println("Equal");
else
System.out.println("Not Equal");

Thanks,
Jaimesh.
Hi Amarkirt,

In Class B we are overloading the method meth() and not overriding it.
When you are overloading, the reference type is considered and hence in both the calls to meth() "parent" was getting printed.

Let me know if you need any more explanation.

Thanks,
Jaimesh.
public class hashtest1 {
public static void main(String[] args) {
Foo f1= new Foo();
Foo f2=f1;
Foo f3= new Foo();
}
}

Assuming that Foo has correctly implemented hashCode and equals methods, which of the following will always print out "true" ?

Options:

if(f1.equals(f2)) System.out.println("true");
if(f1.hashCode() == f2.hashCode()) System.out.println("true");
if(f1.hashCode() != f3.hashCode()) System.out.println("true");
if(f1 == f2) System.out.println("true");

Can someone explain me the answer for this question?

Thanks,
Jaimesh
Hi All,

I have a class pack in a package packed as follows

package packed;
public class pack
{
static public int x1 = 7;
static protected int x2 = 8;
static int x3=9;
static private int x4 =10;
}
An other class Test in a different package
import packed.pack;
class test extends pack
{
public static void main( String args[] )
{
pack p = new pack();
System.out.println( pack.x2 );
}
}

If i remove static from protected variable x2, i am getting a compiler error that x2 is not visible.Why is it so?

As per the API, i should be able to access the protected variables in or outside the package using inheritance.