Top "Instance-variables" questions

In object-oriented programming with classes, an instance variable is a variable defined in a class (i.e. a member variable), for which each object of the class has a separate copy.

How do servlets work? Instantiation, sessions, shared variables and multithreading

Suppose, I have a webserver which holds numerous servlets. For information passing among those servlets I am setting session and …

java multithreading servlets session-variables instance-variables
What is an instance variable in Java?

My assignment is to make a program with an instance variable, a string, that should be input by the user. …

java instance-variables
Passing variables, creating instances, self, The mechanics and usage of classes: need explanation

I just rewrote a working program into functions in a class and everything messed up. First, in the __init__ section …

python class call parameter-passing instance-variables
How to get instance variables in Python?

Is there a built-in method in Python to get an array of all a class' instance variables? For example, if …

python methods instance-variables
Ruby convert Object to Hash

Let's say I have a Gift object with @name = "book" & @price = 15.95. What's the best way to convert that to …

ruby object hashmap instance-variables
Ruby class instance variable vs. class variable

I read "https://stackoverflow.com/questions/826734/when-do-ruby-instance-variables-get-set" but I'm of two minds when to use class instance variables. Class variables …

ruby instance-variables class-variables class-instance-variables
What does @@variable mean in Ruby?

What are Ruby variables preceded with double at signs (@@)? My understanding of a variable preceded with an at sign is …

ruby syntax instance-variables class-variables
Should I instantiate instance variables on declaration or in the constructor?

Is there any advantage for either approach? Example 1: class A { B b = new B(); } Example 2: class A { B b; A() { …

java constructor instance-variables
Static vs Instance Variables: Difference?

What is the difference between a static and instance variable. The following sentence is what I cant get: In certain …

java class instance-variables static-variables
Can non-static methods modify static variables

I am wondering how a non static method can modify a static variable. I know that static methods can only …

java methods static instance-variables access-modifiers