Meher Parveen

Greenhorn
+ Follow
since Nov 25, 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 Meher Parveen

Thanks everyone for your wishes.

Ashni, I wouldn't know. It depends on the kind of mock tests that your taking.

Vidhya, i didn't buy any mock tests, i didn't have enough time to do that. But i would advice that you do, it would really help. I did practice free mock tests that are available online. All the best to you.

Prashant, congratulations to you. It feels so surreal to have cleared it!
16 years ago
Hi all ranchers,
I cleared the SCJP 5.0 yesterday and scored a whooping 95%.
I would like to thank everyone on this forum, for helping me along the way...
It turned out to be a lot simpler than I expected.
Cheers everyone and thanks once again
16 years ago
I saw a question about static imports and enum in Whizlabs 5.0

The question had to do with valid imports and the answer was
import static xyz.test.*;
and
import static xyz.test.utils;
import static xyz.test.Inner;

But static imports are supposed tow ork only for static members of a class. How does it work for the enum Inner here?
-Meher
I have this additional doubt.
will it be specified that we need to choose 3 options? Will the number of correct choices mentioned?
The initial value of i was 1.
Thanks for the detailed explanation Peter. That really helped.
-Meher
I don't get a problem with the generic class definition, its only a problem with adding an Integer/Number to the list, depending on what is put in place of "X".
I still don't understand why it is so.
I have a doubt in operator precedence...
evaluation of

give a result of 7. It should be 9 since ++ has higher precedence that % or *.

The result of 7 also means 4*i is evaluated before i++ or i++%4?!

I am confused!
-Meher
I have a generic class :


How do i add elements to twoLst above.... when i trying doing it i get a compiler error:


What am i doing wrong here?

If i change the definition of gen2 to below mentioned it works!


both these definitions of gen2 should amount to the same thing?! Am i missing out something there.

Thanks,
Meher
thanks Kelvin, for explaining that for me.
Hi everyone,
Noticed an interesting behavior of Arrays.asList(T[]) ,method:


Now i have read in K&B that both this array and list refer to the same data, and changes made to the list will reflect in the array.
But when i try to run this code i get an java.lang.UnsupportedOperationException in line1, as well as line2 (if line1 is commented).

Does anyone know what are the other restrictions on the list?
I found an explanation to this at this blog.
So whats the point of getting an array asList ?
-Meher
Thanks Paul,
That makes sense.
option 2 aught to be valid.
I don't get an error in the line you mention.

I get an error in the call to testGenericMethod(), but i don't know why your getting this error
Hi everyone,

I was playing around with declaring inner classes and this particular syntax confuses me.

For a simple inner class to declared in the main() of the outer class we use:


where as if we have to define an array of these inner classes in the main() of the outer class, all we need to do is:


This difference in syntax confuses me. Any ideas on why it is so?

Thanks,
Meher
Hi Alexsandra,

In the first case,


the compiler will not check for element types in the arraylist simpleList.
So you could add a String to this List and the compiler will not complain.

Where as when you declare,

The compiler will firstly give you a warning about unchecked conversion from ArrayList<Integer> to ArrayList tolerated.
But the compiler will do a type check for Integer for all the elements of the list.
What i think happens is that the above code amounts to


Hope this helps!
-Meher