Wednesday 28 August 2013

Use of static and non static members in another classes

static members are used with the class name without creating the object of the class..
we cannot declare local variable as a static.
we cannot use non static member into static member..

Use of Static member into another class

you can use it along with class name without creating the object of the class.

you will get compile time error if you directly use it



we cannot call non static member like this......
we call non static member by creating the object of the class


first we create the object of the class and by using the reference variable we call the non static method...
if you can do this it will provide error ..


because we are calling non static member into static...
we will  call non static member through object creation.

No comments :

Post a Comment