Results 1 to 3 of 3
- 02-12-2011, 07:44 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 7
- Rep Power
- 0
accessing variables in a method that returns a void
hello,
i am trying to learn java and came across this snippet of code.
how can one acess the variables in this case? as the method has a void or null return so it wont return anything, correct?Java Code:public synchronized void invert() { red = 255 - red; green = 255 - green; blue = 255 - blue; name = "Inverse of " + name; }
-
These variables have not been been declared within the method and thus are class fields and are visible throughout the class.
- 02-12-2011, 08:00 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
Accessing variables from another class
By tti123 in forum New To JavaReplies: 3Last Post: 01-23-2011, 04:43 AM -
Inheritance - accessing private variables
By counterfox in forum New To JavaReplies: 3Last Post: 04-26-2010, 01:21 AM -
Accessing Variables From a Different Class?
By Sterling in forum New To JavaReplies: 1Last Post: 04-08-2010, 05:01 PM -
accessing variables
By emp in forum New To JavaReplies: 3Last Post: 04-23-2009, 04:36 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks