What is the difference between static method and instance method in Java?



What is the difference between static method and instance method in Java?..

Answer / Pranjul Shrivastava

In Java, static methods belong to a class as a whole, while instance methods belong to individual objects of the class. Static methods are called using the class name, don't have access to instance variables (as they are shared among all instances), can't be overridden by subclasses, and can only call other static methods or static variables. Instance methods are called using object references, can access both instance and static variables, and can override methods from superclasses.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is high level language in computer?

1 Answers  


How to use string tokenizer class.

1 Answers  


what is Dictionary? and what purpose it is used for?

3 Answers  


Is it possible to do method overloading and overriding at a time

3 Answers   L&T,


what is platform independence in java?

5 Answers   CSC, HSBC,


What is unicode used for?

1 Answers  


What is codebase?

1 Answers  


What is difference between final and immutable?

1 Answers  


What language is java written?

1 Answers  


where to use join method and explain with real time senario?and programatical explenation also..

1 Answers   TCS,


What are the different types of methodologies?

1 Answers  


What are virtual methods?

1 Answers   TCS,


Categories