The instance tag has no usage guidance.
1
vote
4answers
206 views
What are the differences between class variables and instance variables in Java? [closed]
I'm very new to Java and want to be difference between class variables and instance variables.
For example:
class Bicycle {
int cadence = 0;
int speed = 0;
int gear = 1;
}
How are ...
2
votes
2answers
210 views
observer class as instance
Sometimes I read in observer-pattern descriptions, to make the constructor of a observer base class protected so the class will be abstract. but by making the constructor public (if even one is ...
0
votes
2answers
125 views
Objects or primitives as arguments
I have come across the term "garbage disposal" and now I'm worried about using up too much memory. Apparently (correct me if I'm wrong) every time an object is created, memory is reserved for it, and ...
1
vote
5answers
278 views
Understanding basics of object declaration in Java
Is there a case when an object is declared without a call to the constructor?
as in, for example:
ArrayList<Integer> grades;
Or is it always the case that ArrayList<Integer> grades (as ...
1
vote
2answers
384 views
Instantiating objects in Java [closed]
I'm learning now Java from scratch and when I started to learn about instantiating objects, I don't understand - in which cases do I need to instantiate objects?
For example I'm studying from TutsPlus ...
11
votes
4answers
2k views
Make methods that do not depend on instance fields, static?
Recently I started programming in Groovy for a integration testing framework, for a Java project. I use Intellij IDEA with Groovy plug-in and I am surprised to see as a warning for all the methods ...
1
vote
3answers
347 views
Why are inheritance and interfaces restricted to instance members?
Disclaimer: I think the rules are almost the same in most OO languages, but since I'm most familiar with C# I'll be relating to this specific language.
I think that the use of attributes and ...