aspose file tools*
The moose likes Beginning Java and the fly likes i need help for my maps and sets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "i need help for my maps and sets " Watch "i need help for my maps and sets " New topic
Author

i need help for my maps and sets

raj david
Greenhorn

Joined: Dec 21, 2009
Posts: 9
Hello,

I want to create private instance variable so that it is suitable interface type to hold a map, for example. Can you advise me if this is how you do private instance variable for maps and sets.


private Map<String, String> TestOut = new HashMap<String, String>>();

Am I right that I can then use TesOut to do whatever is necessary?

Thanks

Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Am I right that I can then use TesOut to do whatever is necessary?


What do you mean by that?
raj david
Greenhorn

Joined: Dec 21, 2009
Posts: 9
Sridhar Santhanakrishnan wrote:
Am I right that I can then use TesOut to do whatever is necessary?


What do you mean by that?


I can then use TestOut in a method body...Say in a public static void test() method
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
I can then use TestOut in a method body...Say in a public static void test() method
You cannot access an instance variable from a static method.
raj david
Greenhorn

Joined: Dec 21, 2009
Posts: 9
Tom Reilly wrote:
I can then use TestOut in a method body...Say in a public static void test() method
You cannot access an instance variable from a static method.



That's ok, It was just figure of speech. Did I created private instance variable correctly?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What happened when you tried it?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: i need help for my maps and sets