answersLogoWhite

0


Best Answer

No you cant, any compiler I've ever used wont allow this. It would not make any sense to do this anyway.

because the JVM directly accesses ur top class without instantiating it. Though for accessing the instance data members, the class must need to be instantiated.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

No, Java will fail to compile: "illegal combination of modifiers: abstract and static"

This is a rather odd error, since Java does allow you to override static methods.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

There is no reason that you cannot use static variables in constructors. Just keep in mind that static variables are shared among all instances of a class, so class constructors should not be used to initialize them.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

No.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can an abstract method be declared static in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

When do you declare a method or class abstract in java?

when overriding of a class or a method is necessary, they can be declared as abstract


What do mean by interface in java?

An interface in Java is like an abstract class, but there are no method bodies allowed in it and it has to be declared with the interface keyword. It is Java's way of getting around the Deadly Diamond of Death. Only abstract methods and constants are allowed in it.


What is static java most commonly used for?

Static java method is the same as a static variable. They belong to a class and not an object of that class. If a method needs to be in a class, but not tied to an object, then one uses static java.


Do you use virtual functions in Java?

Every method in java that isn't a class (static) method is automatically "virtual." If you want to disable virtual overrides, make the method "final" in the base class.


Is it possible to define a java static method inside a main method?

Because, the main method is the starting point of the java program and if we need an object of that class even before the main can be invoked, it is not possible. Hence it is declared static so that the JVM Can acess the main method without having to instantiate that particular class


Can you refer static method from non static method in java?

Yes, it is possible to call a static method from a non-static method. However, it is not possible to call a non-static method from a static method without first having an instance to operate on.


Is it possible to write in static variables in main method in java?

Short answer: No. Only class member variables may be declared static. Local variables with a static declaration will throw an error (usually "illegal start of expression").


Interface in java?

include all abstract method


Can you overwrite main function in java?

You can not overwrite a static method in Java,and 'main' is a static method.so,you can't overwrite the 'main'.


Abstract method with example in java?

An abstract in java is used to specify that the class/function is not yet complete. When a class in declared as abstract it means that it is not meant to be instantiated (you can't create variables of that type). This is because they are meant to be more of a guideline for other classes. When a class extends an abstract class it must either define all of the abstract methods from the abstract class or it must also be declared as an abstract class itself.


What kind of constructs can be declared in a Java interface?

Constants and abstract methods. That's it.


How do you uss static in java?

It is uss to define class and method of pogrom's.