Royale Summers wrote:If I'm understanding then, these Class variables would be Constants?
Royale Summers wrote:I found this link that provides an exercise: https://www.guru99.com/java-static-variable-methods.html#1
It also means there is one copy of that variable, irrespective of the number of instances. There is one variable if there is 1 instance, 2 instances, 3 instances, 1000000000 instances or even no instances.
Junilu Lacar wrote:. . . static says “This is shared by all Dog instances,” . . .
Yes, and no. There is only one of each static field, but it doesn't have to be a constant. Some people think there should be no such thing as a static variable using the term in its strict sense as meaning something that might change. They would make all their static fields constants.
Royal Summers wrote:. . . So, there's only one and it is usually a Constant?
That's a pleasure
Thanks for the assistance of everyone!
every body has explained well,
Royale Summers wrote:Can anyone explain to me the difference between an Instance variable and a Class/Static variable
Slightly odd nomenclature maybe, but it looks more like ’technically‘ right to me
Billy Willis wrote:. . . This might be 'technically' wrong . . .
Let nothing stop you! Not even this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton