Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

xiii. Briefly describe the differences between an abstract class and an interfac

ID: 3919774 • Letter: X

Question

xiii. Briefly describe the differences between an abstract class and an interface. xiv. Briefly describe the similarities between an abstract class and an interface. xv. If a valid class implements the Comparable interface but does not override the compareTo method, what can be said about the class? xvi. Explain why a class cannot be both abstract and final xvii. Briefly describe the differences between method overloading and method overriding xviii. What is super in Java? xix. Briefly describe the use of super in a constructor. xx. In a method body, what is this and what can you do with it?

Explanation / Answer

xiii)
abstract class can have method implementations but interface can't have implementaions of methods
abstract calss can have non final data varaibles but interface can't, all data variables are final
xiv)
abstract class and interface both have abstract methods..
both allow final variables
xvi)
because..abstract class allows changes to its methods and variables...
but if a class declared has final..changes are not allowed..
hance class can't be both final and abstract
xvii)
method overloading: more than one methods with same name but different input parameters..by type or number
method overriding: two methods with same name..one from super class and another from sub class...but sub class methods will be executed..it overrides the super class method