What is the difference between a static and non-static method in Java?
A. A static method belongs to the class and can be invoked without creating an instance, while a non-static method belongs to an instance and must be invoked on an instance.
B. A static method belongs to an instance and can be invoked without creating an instance, while a non-static method belongs to the class and must be invoked on an instance.
C. A static method belongs to an instance and can be invoked on an instance, while a non-static method belongs to the class and must be invoked without creating an instance.
D. A static method belongs to the class and can be invoked on an instance, while a non-static method belongs to an instance and must be invoked without creating an instance.
Answer:A
What is the difference between a static and non-static method in Java?
A. A static method belongs to the class and can be invoked without creating an instance, while a non-static method belongs to an instance and must be invoked on an instance. B. A static method belongs to an instance and can be invoked without creating an instance, while a non-static method belongs to the class and must be invoked on an instance. C. A static method belongs to an instance and can be invoked on an instance, while a non-static method belongs to the class and must be invoked without creating an instance. D. A static method belongs to the class and can be invoked on an instance, while a non-static method belongs to an instance and must be invoked without creating an instance.