Static methods can t be abstract in Java

0 votes

Why doesn't Java allow an abstract method to be defined as static?

For example:

abstract class demo {
    abstract void test( ); // <-- this is ok
    abstract static void test1(); //<-- this isn't why?
}
Oct 12, 2018 in Java by misc.edu04
• 1,450 points
857 views

1 answer to this question.

0 votes

Well, Java doesn't allow this because of a basic contradiction.

  • "abstract" means to "Implements no functionality"
  • "static" means that "There is functionality even if you don't have an object instance"

Because of this Java compiler might get confused as to which concept to follow and thus this practice is prohibited in Java.

answered Oct 12, 2018 by v.liyyah
• 1,300 points

Related Questions In Java

0 votes
2 answers

When to use Static Methods in Java?

A static method has two main purposes: For ...READ MORE

answered Aug 10, 2018 in Java by samarth295
• 2,220 points
15,553 views
0 votes
0 answers

Can I override and overload static methods in Java?

My questions are: Why can't static methods be ...READ MORE

May 15, 2022 in Java by Kichu
• 19,050 points
249 views
0 votes
1 answer

Static Map initialization in Java

I would suggest you to use the ...READ MORE

answered May 4, 2018 in Java by Akrati
• 3,190 points
12,456 views
0 votes
1 answer

How can two strings be concatenated in java?

You can concatenate Strings using the + operator: System.out.println("Your number ...READ MORE

answered Jun 6, 2018 in Java by Daisy
• 8,120 points
637 views
0 votes
1 answer

Can Static methods be inherited in java?

A subclass inherits all of the public ...READ MORE

answered Apr 30, 2018 in Java by Daisy
• 8,120 points
1,650 views
0 votes
1 answer

Why the main() method in Java is always static?

As you might know, static here is ...READ MORE

answered May 9, 2018 in Java by geek.erkami
• 2,680 points
1,894 views
0 votes
1 answer

Overriding private or static method in Java

You cannot override a private or static ...READ MORE

answered Jul 31, 2018 in Java by code.reaper12
• 3,500 points
14,739 views
0 votes
1 answer

Can't access static fields in inner classes in Java

Well, the major idea behind this concept ...READ MORE

answered Oct 9, 2018 in Java by anto.trigg4
• 3,440 points
1,559 views
0 votes
1 answer

NoClassDefFoundError in Java

Can’t tell you the exact reason as ...READ MORE

answered May 25, 2018 in Java by v.liyyah
• 1,300 points
2,291 views
0 votes
1 answer

Java Static nested class

Hi, to understand their usage, you must ...READ MORE

answered Jun 8, 2018 in Java by v.liyyah
• 1,300 points
525 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP