Java Tutorial
IntroductionEnvironment SetupIDEBuild ManagementLanguage SpecificationBasic ProgramVariablesData TypesPackagesModifiersConditionalsLoopsObject OrientedClassesSuperInterfacesEnumStatic importInheritanceAbstractionEncapsulationPolymorphismBoxing & UnboxingConversion Formatting numbers Arrays Command line arguments in java Variable Number of arguments in Java Exception handling in Java String handling in Java StringBuffer and StringBuilder in Java Mathematical Operations in Java Date and Time in Java Regular expressions in Java Input output programming in Java File Handling Nested Classes Collections Generics Serialization Socket programming Multi-Threading Annotations Lambda Expressions Reflections in Java Singleton class in Java Runtime Class in JavaHow to load resource in JavaHow to load properties file in JavaAdvanced
Log4j – Logging framework in JavaInterview Questions in JavaAbstraction means specifying only what has to be done but not how it has to be done. We can achieve abstraction in Java by –
- Interfaces
- Abstract Classes
package abstraction;
public class AbstractTest {
public static void main(String [] args){
//Below statement throws error saying Car is abstract.. can not instantiate
//Car c = new Car()
//Below statement will work..
HatchbackCar c1 = new HatchbackCar();
c1.move();
}
}
abstract class Car{
public abstract void move();
}
class HatchbackCar extends Car{
public void move(){
System.out.println("Hatchback move method");
}
}
Here is the output of above code.
Hatchback move method
Web development and Automation testing
solutions delivered!!