Hello, does anyone have good tips where I can get some more clarification on this subject within java? Youtube or an article. It all remains a bit foggy. thanks in advance
Clarification on this subject within java.
Under discussion
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Viktor Blank
4 January 2020, 16:57
Hi, i'm not sure if i understood you question correctly.. In this particular task you should use Increment after creating an object to count them. You will get a deeper explanition on counting and also on difference between static and non-staic on lvl 6. For now it's pretty striaghtforward
0
Joost
4 January 2020, 17:03
Then my question is wrong. I mean more on the topic Practice with variable visibility. But thanks for the reply!!
0
horst
4 January 2020, 22:54
With "variable visibility", do you mean the different access modifiers (public, private...) in front of the variable or the actual visibility within a class/file/programme/method?
The former will be covered later on in the course. For now it is enough to know that it has something to do with accessibility of certain fields or values from outside (other files, other packages, etc. ). If you want a very condensed overview about this whole "hierarchy of access"-thing and what it is good for, I recommend the material on hyperskill (which, by the way, is another great yet sometimes extremely challenging online java course).
For the latter, I think the starting point is to understand that your code blocks are all nested inside one another. This means that the variables you declare on the outside (or further up) are definitely visible, readable, and writable further inside, but not the other way round:
Notice that it is important on which level/hierarchy you declare the variables, not where you actually initialize / assign a value to them.
+1
Joost
6 January 2020, 14:30
Many Thanks. Its getting to me now. Cheers
0