adspace


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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

explain different ways of using thread? : Java thread

1084


Realized?

2265


What is an object in java and how is it created?

1141


Is minecraft 1.15 out?

1045


What is the difference between equals() and == in java?

1042


What is a constructor overloading in java?

1125


What is java string pool?

1083


Write a program to print count of empty strings in java 8?

1087


Write a program to find the whether a number is an Armstrong number or not?

1101


How to sort array in descending order in java?

996


What do you mean by an interface in java?

1105


What is a classloader in java?

1090


What is the difference between break and continue statements?

1128


What is parsing in java?

1043


Explain public static void main(string args[]) in java.

1078