I am just a beginner in java and have some queries on abstraction in java
1 :- Suppose I have created an interface CalArea which have abstract area function mentioned in it.
Now I have created two classes Square and Circle both implements CalArea interface and overrides the method area to calculate the area of shape and the code is working fine.
My question is If I remove interface or instead of implementing an interface I am calculating the area of Square and Circle using area method which is not overrided.
Will it still be called an abstraction ?
Because in both cases we are using concrete class object to call area function as we couldn't create objects of interface. And we are only providing the essential detail to user that is method name instead of method implementation.
2. In my opinion interface only force us to implement some methods which are common to all class to lie in particular category.
For example : If Ferrari needs to be car it should implement some features which are common to all cars . Just the implementation could me different with some extra features added on it.
How can interface provide 100% abstraction just because it doesn't have concrete methods. At last user will use the object of class which implements interface to access the method. so if user is only using method name then even without interface we are achieving 100% abstraction.
As per my knowledge abstraction means just allowing user to use method name to perform his/her task rather than method implementation details. Which we even do without interface and abstract class.
Please correct me if I am wrong