+ 12

What is a difference between static and abstract functions /classes?

21st Nov 2016, 4:59 PM
Nelli
Nelli - avatar
6 Réponses
+ 8
An abstract class is that which must be extended. If you use abstract method in a class then that means the class is abstract also so you have to declare that class as abstract. Abstract class behaves as a template. Abstract class can contain static data. Abstract class can not be instantiated While Static class is that whose methods and variables can be called without creating the instance of the class. Static means which is initialized once for example our main method is initialized only once.
21st Nov 2016, 5:06 PM
Sonu Baghel
Sonu Baghel - avatar
+ 2
an abstract class is that which can have one or more than one abstract methods.abstract methods are those which don't have implementation/body rather only has its declaration.it will necessarily have abstract keyword.Abstract class is used so that we can provide abstraction I.e can hide implementation and leave it on its child class...we can't instantiate our abstract class.all variables inside abstract class must be static. and, static is a keyword which makes any variable or method a class level variable or class level method ,means we can access it by our class name without making object of class.
24th Jan 2017, 4:01 AM
ayush
+ 1
an abstract class needs to have a abstract method to extend in derived class but static members can be called anywhere without making object these are global
23rd Nov 2016, 7:05 AM
gulshan kumar
gulshan kumar - avatar
+ 1
abstract class dont have a behaviour so we cant able to instantiate it.
12th Dec 2016, 7:48 PM
anmol gupta
anmol gupta - avatar
- 1
There are abstract and static methods but there is no such kind of static class. And moreover which class contains at least one abstract method, then that will be called as abstract class.. You can call static members instead of static class.. the class can contains static variables, static methods, static blocks.. but "static" keyword is not applicable for class. Instead of this question you can search for Static Vs Instance members... I hope this answer will helps your question😊
2nd Jan 2017, 5:14 PM
Dhananjaya Naidu
Dhananjaya Naidu - avatar
- 2
Nelli ur very smart and beautiful girl
30th Nov 2016, 11:07 AM
Erind Hidri
Erind Hidri - avatar