Variables exist within the scope of their creation.
Make a variable within a class, and that's its scope.
Make a variable within a method, and that's its scope.
So make it within the program, but outside of any one class.
If you make it in the program.cs file, and make it public then any class within the program can access it as... (source)
Vedro - lets put it this way: You are on the beginning of your programming path, if Iam not mistaking. So, if you know what is local and global variable, will do good for the next a couple of years. Belive me. I`m coding for a 2,5 years and havent encountered any need or something of using common varibale.
Truly, I dont even need a common varible (even if I dont actually know what this is, or if it exists).
So, if you know local and global variables, and you know how to operate and use them, is more then enough.
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...