Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i need help for my maps and sets

 
raj david
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am I right that I can then use TesOut to do whatever is necessary?


What do you mean by that?
 
raj david
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic