ramki srini

Greenhorn
+ Follow
since Aug 27, 2002
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 ramki srini

Hello guys,
Last week I passed the SCJP 1.4 with the help of JavaRanch SCJP forum. I am planning to take up the SCWCD now. I am new to this Java field. Please let me know how to start on this. What are the relevant books I have to purchase for preparation.
Again I am depending on Javaranch for SCWCD.
Thanks.
Thanks for all the help. It's really great to be part of this ranch. Its a great learning experience.
I passed SCJP 1.4 today with 80%. Though its not that big score I am happy with this. I expected to do much better than this.
I spent lot of time on threads and I have got 100% on threads (about 8 questions). Thanks to Dan.Chislom for his mock. Without his mock I wouldn't have scored 100% on threads.
Thanks for Kathy for allowing me to be a Beta tester for her recent exam. That really gave lots of confidence.
Thanks again everyone.
Thanks
Ramki.
16 years ago
Always remember this hierarchy,
byte-->short-->|
|-->int-->long-->float-->double
char-->|
You can always use implicit conversion for the direction of the arrow. For the other way you have to do explicit cast or else compiler will comply.
So Dan, whats the answer?
Is it only 'c'.
Then fenn from where u get this question which says the answer a,d,e...
Thanks
Ramki
I think the answer is c. Maybe e. I am not sure of e. someone pls correct me.
a) You can directly free the memory allocated by an object.
-----You can't directly free the memory. Only garbage collector can do this. You can only make the object eligible for garbage collection.
b) You can directly run the garbage collector whenever you want to.
-----You can't run the garbage collector whenever you want to. Garbage collector is a low priority thread. You dont have any control on this.
c) The garbage collector informs your object when it is about to be garbage collected.
-----I think this is true since the finalize() method will be executed before garbage collecting.This will be a notification for the object.
d) The garbage collector reclaims an object memory as soon as it becomes a candidate for garbage collection.
----GC is a low priority thread and we dont have any control on when it will run to reclaim all the eligible GC'ed objects.
e) The garbage collector runs in low-memory situations.
I think its true. I dont have much explanation..Pls someone add more to this.
Thanks
Ramki.
I dont think you have to get a new book for preparing for SCJP1.4 . If you like you can wait and get Kathy Sierra's book which I think will be coming sometime this month.
There are lots of Web materials available for the new topics covered under 1.4. You can use them always.
double x = new Double("123.45").doubleValue();
If we take "123.45" as String literal, then I don't think it will be garbage collected anytime.
All String literal will be kept in the String pool and will be used by the JVM in all future references for the same literal.
I hope I am right, but I am not sure. Please correct me if I am wrong.
Regards
Ramki.
Hi Kathy,
I like to be participant in the Beta Testing. Pls include me also.
I hope I am not late.
Thanks
Ramki.
toUpperCase() method will return a new String only if the value gets changed or else it will point to the same String in the pool.
In your case "STRING".toUpperCase will have no impact(as everything is uppercase already) on the "STRING" literal and so it will point to the same STRING in the pool and thats why the result EQUAL.
It has to implement Comparable interface. Below is the description for this :
TreeSet public TreeSet()
Constructs a new, empty set, sorted according to the elements' natural order. All elements inserted into the set must implement the Comparable interface. Furthermore, all such elements must be mutually comparable: e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the set. If the user attempts to add an element to the set that violates this constraint (for example, the user attempts to add a string element to a set whose elements are integers), the add(Object) call will throw a ClassCastException.
Because the scope of the variable is different in both case.
The first one will be the instance variable which you can access only through the instance of the class(unless its static variable).The second one will be within the scope of the Main method.
The compiler will complain only if you add duplicate instance variables or duplicate variable within the same scope (for ex. within a method).
I hope the above explanation is right.
Arpana, whatever you mentioned about Overridden method is correct, but still a small point to note down.
"'object of class' decides which method to be invoked" -- This is true only for Non-Static methods...For Static methods the Type of the object will decide which method to invoke..
I hope I am right with the above point.
Integer.MAX_VALUE + 1 will result in Integer.MIN_VALUE.
So Integer.MAX_VALUE + 2 will result in Integer.MIN_VALUE + 1.
So i1==i2 is true.
That's why the result is true,false,false.
Even i am not sure with the answer..but if you say that before garbage collection the finalize method will be invoked for that object right..
Are they meaning this?
Anu,
1 | 2& 3>> ((1/2) + 3).
Why 1/2 is returning 1 in your explanation...
int f = 1/2 returns 0 when i tried...pls explain.