Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
general knowledge
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
beans
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


Difference between Class and Instance variables in Java?
Question Posted on 28 Apr 2022

Home >> Java >> Java Questions >> Difference between Class and Instance variables in Java?




Difference between Class and Instance variables in Java?
Below are the difference between Class and Instance variables in Java:-
0
0

Base of differenceClass VariablesInstance Variables
KeywordClass variables are mainly declared with keyword static.Instance variables are mainly declared without static keyword.
Accessed byClass variables can be accessed by using either class name or by object reference.On the other hand Instance variables can be accessed by only through object reference.
SharedClass variables are common to all instance of class and these variables are shared between the objects of a class.On the other hand Instance variables are not shared between the objects of a class and each instance have their own copy of instance variables.
ReflectAs class variables are common to all objects of a class, changes made to these variables through one object will reflect in another.As each object will have its own copy of instance variables, changes made to these variables through one object will not reflect in another object.


 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
What are the main difference between Array and Arraylist
What is classloader in Java and name of some classloader
Different modules of the Spring framework
Difference between Object and Class
Most important 15 aspects that Java Developer should learn in year 2020






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |