Abstraction in java revision video for interview. Java By kiran
visit: javabykiran.com for joining classes. Abstraction is a process of hiding details about implementation from the user while letting them utilize the services or functions. Therefore, the user will know what an object does, but not how it does it. It is done to simplify the user interface while hiding the complex processes. Exposing only required or important things is called abstraction Abstraction can be done in two ways : Abstract class Interface It is used for maintaining the standards of coding in the project. Interface -------------- One of the java principles says that we must follow the I to C design. This means that every class should be implemented from Interface In the industry, architect level people create interfaces and then it is given to the developers for writing classes by implementing interfaces provided This is the best way to expose our project’s API to some other projects. For example, ICICI bank can expose methods or interfaces to various shopping carts The interface is the same as an ordinary class but remember below points We cannot instantiate Interface but we can create reference variables The interface doesn't have a constructor It can be compiled but cannot run The interface can extend the interface The interface can extend multiple interfaces Abstract Class -------------------------- Abstract class is just like a normal class but with some extra features which we will see in this chapter Abstract class can have a constructor It can have abstract methods or concrete methods or nothing [empty class] or mix of both methods To use abstract method of a class, we must extend the abstract class with an ordinary class or must implement all abstract methods in that ordinary class If we don't want to implement or override that method, make those methods as abstract If any method is abstract in a class then that class must be declared as abstract We cannot instantiate abstract class Multiple inheritances are not allowed in abstract class but allowed in interfaces Abstract classes are useful if we want others to not call our class directly but through Inheritance Abstract static final combinations are not allowed in java. join our institute to know more about us. Thanks https://www.jbktutorials.com/corejava/abstraction-in-java.php#gsc.tab=0
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.