Re: what is difference between Class variables and Instance variables?




<rahul8143@xxxxxxxxx> wrote in message
news:1124014399.664458.218080@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> hello,
> what is difference between Class variables and Instance variables?
>

Instance variables belong to the object instance. They're the fields of the
object. Class variables belong to the class as a whole--they're static
variables. I recommend Roedy's definitions here:

http://mindprod.com/jgloss/instancevariable.html or if you're up to it the
JLS definition here
http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#28536

Cheers,
Matt Humphrey matth@xxxxxxxxxxxxxx http://www.iviz.com/


.



Relevant Pages

  • Re: Delegating class methods
    ... Every object has instance variables. ... are talking about alternatives to class variables. ... The main confusion with Ruby class variables comes from: ... It would be nice if there was a common term for 'instance variables ...
    (comp.lang.ruby)
  • Re: Class instance variable idiom
    ... I would also recommend to not use them. ... "class instance variables", but I've yet to experience any problems ... with class variables. ... In Ruby> 1.8, class variables are going to be somewhat more strictly ...
    (comp.lang.ruby)
  • Re: what is difference between Class variables and Instance variables?
    ... > what is difference between Class variables and Instance variables? ... Prev by Date: ...
    (comp.lang.java.programmer)