sree vankadara

Greenhorn
+ Follow
since Apr 22, 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 sree vankadara

Hi Henry,

After your first reply, i created a sample file and this works for mroe tahn 6000 records. I have some issue in data file. I am very sorry and thanks a lot.
13 years ago
All Id values are unique. But if i add the same value to arraylist and print the list, all 12000 odd values are printed
13 years ago
Hi All,

My requirement is to read a text file with around 13000 records and store values. In each record with around 10 fields, i need only 2 field values. This stored values should be searched and fetched while executing the program. I chose to go for hashmap.

Though i declare the initial capacity of 15000 for has map my hashmap is holding values only till 5610. I am confused as to why this is hapening. When i print the values from hashmap as soon as i add them i can see 12000 records printed. when i iterate and print the hashmap finally or check for the size of hashmap i get only 5610. Any help is greatly appreciated.

13 years ago
I am getting compile time error in both cases.
I did not get how are you able to run it in the first case. (Static method overridden by non static method). Pls clarify
15 years ago
what I think is that c1.story reference cannot be made as the object is null. As disussed earlier, both c1.story and c2.story refer to same short object.since c2 object reference still exists, short is not eligible for gc.
Hi,
sakthi karthik, the second object that was referred when only c1 is made null is about the Short wrapper object. So I had counted as 4 objects when c2 is made null explicitly.

However, as explained by kesava narayana I understand that there will be only 3 objects created(object refered by c1,object refered by c2, Short wrapper object). Both short references refer to the same object as it has same value.
So according to the initial program, only 1 object i.e. object refered by c1 is eligible for gc.

Nabila Mohammad, though objects are passed by value, if we change the value of instance variable or manipulate any data which the reference variable is referring to, the values are changed (Because copy of reference variable and reference variable pass are same i.e, both are refereing to the same object.) However, if we change the value of reference variable itself it is as good as changing the value of the copy and refernce to the object is lost but does not change the object value. So changing the values refered is differnt from changing the reference.
The link suggested by Stevi Deter helps in understanding it.

Pls correct me if I am wrong. Also, I did not get what error are they refering to in this question (errata thread). Anyone pls clarify.
Thank you. So if I explicitly make c2 null then 4 objects are eligible for gc. Right?
hi, first of all, thanks a lot for correcting my procedure to learn.

When I executed and printed the value, c1 and c3 are shown as null. I did not get why though c2 is not null even after nullifying the reference.

the book which I am going through says that there are 2 objects eligible for gc, c1 and its wrapper Short.

I am trying to understand why not c2 and c3.
class CardBoard {
Short story=5;
CardBoard go(CardBoard cb){
cb=null;
return cb;
}
public static void main(String args[]){
CardBoard c1 = new CardBoard();
CardBoard c2 = new CardBoard();
CardBoard c3 = c1.go(c2);
c1 = null;
System.out.println("done!!!"+c1 +c2+ c3);
//end
}
}

how many objects are elible for garbage collection when it reaches end. Also could you pls explain the reason.