- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Can we override the static method in Java?
Yes! We can override the static method easily in Java. See the example below.
Example
public class Tester { public static void main(String[] args) { display(); display("World!!"); } private static void display(){ System.out.println("Hello!"); } private static void display(String message){ System.out.println("Hello! " + message); } }
Output
It will print the following lines −
Hello! Hello! World!!
- Related Articles
- Can we override a private or static method in Java
- Can we overload or override a static method in Java?\n
- Can we Overload or Override static methods in Java?
- Can we override the equals() method in Java?
- Can we override the main method in java?
- Can we override a protected method in Java?
- Can we override a start() method in Java?
- Why can’t we override static methods in Java?
- Can we override only one method while implementing Java interface?
- Can we override final methods in Java?
- Can we override default methods in Java?
- Can we call Superclass’s static method from subclass in Java?
- Can We declare main() method as Non-Static in java?
- Can we override private methods in Java\n
- Can we access the instance variables from a static method in Java?

Advertisements