This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes using an object in other class... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

using an object in other class...

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
In classA, hash map ,say I have 3 records like empNo,Employee

Now I need to get these 3 values in class B...

I wrote :---

HashA hmapA=new HashA<String,Emloyee> (having getters and setters)

hmapA.put("1",ABC);
hmapA.put("2",XYZ);
hmapA.put("3",LMN);


In CLassB:-->

If I do ClassA classA =new ClassA();

// This would mean a new object isn't it?

I have HashB hMapB=new HAshB<String,Employee>


I wrote...

hMapB=classA.getHashA();


I am getting null in the above!
Embla Tingeling
Ranch Hand

Joined: Oct 22, 2009
Posts: 237
Doubleposted,

http://www.coderanch.com/t/472146/Beginning-Java/java/Object-null
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
Embla Tingeling wrote:Doubleposted
Thank you for noticing ( ). Closing thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using an object in other class...
 
Similar Threads
Sorting arraylist on the basis of object
q rom overalltesting.com
ArrayList confusion
Thread - Wait() and Notify();
Object is null