Recall & Review
beginner
What is a static method in Java?
A static method belongs to the class rather than any object instance. It can be called without creating an object of the class.touch_appClick to reveal answer
beginner
How do you call a static method in Java?
You call a static method using the class name followed by a dot and the method name, like <code>ClassName.methodName()</code>.touch_appClick to reveal answer
intermediate
Can a static method access instance variables directly?
No, static methods cannot access instance variables directly because they do not belong to any object instance.
touch_appClick to reveal answer
beginner
Why use static methods? Give a real-life example.
Static methods are useful for actions that don't need object data. For example, a
Math.sqrt() method calculates square roots without needing a Math object.touch_appClick to reveal answer
advanced
What happens if you try to override a static method in Java?
Static methods cannot be overridden. If a subclass defines a static method with the same signature, it hides the superclass method instead.touch_appClick to reveal answer
How do you declare a static method in Java?
Which of these can a static method access directly?
What is the correct way to call a static method named
calculate in class Utils?Can static methods be overridden in Java?
Which keyword is NOT related to static methods?
Explain what a static method is and how it differs from an instance method.
Describe a situation where using a static method is better than an instance method.
