• Post Reply Bookmark Topic Watch Topic
  • New Topic

Attributes in several classes  RSS feed

 
bobby town
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I would like to use the attribute A of my class Selecter1, in my main class Resizing. How ? Thanks.

 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell the details TellTheDetails <- click
I am not sure what you are asking about. Are you asking how to access a field in a class from within another class? In that case you need to use dot '.' operator. Just make sure the field is not private (basically make sure that it is accessible from the second class). Better way would be to make the field private and create a getter method for it. Like this:

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!