Results 1 to 14 of 14
- 11-17-2008, 12:51 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 3
- Rep Power
- 0
- 11-17-2008, 03:50 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What you mean by Global variables? Can you explain little more what you are expecting on global variables?
- 11-17-2008, 05:50 PM #3
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Easy. You don't have to because there are no "global variables" in Java.
- 11-17-2008, 09:21 PM #4
Member
- Join Date
- Nov 2008
- Posts
- 67
- Rep Power
- 0
ajaykushwaha may be referring to instance variables.
- 11-18-2008, 07:30 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 11-18-2008, 08:00 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 11-18-2008, 09:25 PM #7
Member
- Join Date
- Nov 2008
- Posts
- 67
- Rep Power
- 0
- 11-18-2008, 10:54 PM #8
- 11-18-2008, 10:59 PM #9
Member
- Join Date
- Nov 2008
- Posts
- 67
- Rep Power
- 0
Global variables is a term that carries between languages. Almost every language has global variables, but not every language uses the term instance variables.
- 11-19-2008, 03:28 AM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Lol, some people doesn't know exact technical terms. So they try to explain on what they know, they heard. What we should do is try to make some guesses and help him/her, isn't it? But if someone done it again and again, we have to think as you said. It's critical I think.
- 11-19-2008, 03:30 AM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 11-19-2008, 08:16 AM #12
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
A global variable is a variable that can be referenced throughout the program with just it's designation, without a need for prepending the Class (or whatever might otherwise be used in other languages), as they exist in a "global" namespace. Java does not have those.
Now maybe he means instance variables, maybe he means class variables, maybe he means "public static final variables", maybe he means something else. Until he clarifies what it is he means, we cannot help him. As "cruel" as that may sound, it is the truth. We can take "stabs in the dark" for years, and eventually touch on what he wants, but why? All he has to do is come back and say "I mean those variables that are defined by a line of code similar to the following: " and post an example. Then, he can not only be helped with his original question, he can also be instructed as to what they actually are.
- 11-19-2008, 09:17 AM #13
I can't imagine this. An instance variable, or a member variable of a class, say a Student class, is about as far away as you can get from a global variable. You have to have a Student object to begin to talk about it.
Static variables in a class are nearly global when public. They are, of course, a really bad idea.
As is the singleton pattern from the Gang of Four book.
- 11-19-2008, 10:53 PM #14
Member
- Join Date
- Nov 2008
- Posts
- 67
- Rep Power
- 0
Similar Threads
-
Would you like to publish your game global?
By tridens in forum Reviews / AdvertisingReplies: 0Last Post: 08-18-2008, 09:42 AM -
Global constants
By Java Tip in forum Java TipReplies: 0Last Post: 02-17-2008, 09:06 AM -
Declaring global variables
By eva in forum New To JavaReplies: 3Last Post: 12-23-2007, 12:11 AM -
How would I declare the variable numbers as global?
By barney in forum New To JavaReplies: 1Last Post: 08-06-2007, 02:17 AM -
save global data in servlets
By Marty in forum Java ServletReplies: 1Last Post: 05-31-2007, 06:38 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks