Whats the need of package as we have absract class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whats the need of package as we have absract class?

can any one explain please

18th Oct 2017, 11:34 AM
Akhil Gorantla
Akhil Gorantla - avatar
5 Answers
0
A package is very different from an Abstract class. A package is simply a place where we store the .java or the .class files. This helps the code find each class file when they look for it in the import and for organization reasons. An abstract class is a .java or a .class file which has abstract methods meaning that they are to be inherited and be fully defined when they are inherited hope this helps happy coding
18th Oct 2017, 12:11 PM
SomeoneAwesome78
SomeoneAwesome78 - avatar
0
but package has abstract methods
18th Oct 2017, 12:12 PM
Akhil Gorantla
Akhil Gorantla - avatar
0
similarly abstract class also has abstract methods na what's difference?
18th Oct 2017, 12:12 PM
Akhil Gorantla
Akhil Gorantla - avatar
0
a package is not a class. i think you are thinking of an interface which contains ONLY abstract methods where as abstract classes can contain both abstract methods and defined methods that are to be inherited
18th Oct 2017, 12:14 PM
SomeoneAwesome78
SomeoneAwesome78 - avatar
0
thanks
18th Oct 2017, 12:22 PM
Akhil Gorantla
Akhil Gorantla - avatar