
Quick Contact
Java Tutorial
- What is Java?
- History of Java
- Hello Java Program
- Features of Java
- Basic Syntax
- Java Setup
- Data Types in Java
- Java Variables
- Operators in Java
- JVM
- Java If-else Statement
- Switch Case Statement
- Java Loops
- Do-While Loop
- Java While Loop
- Continue Statement
- Break Statement in Java
- Constructors in Java
- Oops Concept in Java
- Features of OOPs
- Inheritance
- Exeception handeling
- Aggregation (HAS-A relationship) in Java
- Method Overriding in Java
- Method Overloading
- Java Static Keyword
- Java This Keyword
- Java Final Keyword
- Polymorphism
- Static Binding and Dynamic Binding
- Abstract class in Java
- Access Modifiers in Java
- Difference between abstract class and interface
- Interface in Java
- Garbage Collection in Java
- Java Package
- Encapsulation
- Serialization and Deserialization in Java
- Java Inner Classes
- Java Applets
- Multithreading in Java
- Thread Priorities in Java
- Thread Creation
- Inter Thread Communication
- Wrapper Classes in Java
- Java Input Output
- Java AWT Introduction
- Java Layout Manager
- Java Layout Policy
- Java AWT Events
- Collection Framework
- Collection Framework List Interface
- Swing in Java
- Swing Utility Classes
- Swing Layout Managers
- Java JDBC
- Hibernate Framework Overview – Architecture and Basics
Springboot
- Spring Environment Setup
- Spring Boot CRUD REST API Project using IntelliJ IDEA | Postman | MySQL
- Dockerizing Spring Boot Application | Spring Boot Docker Tutorial
- spring-boot-restapidocumentation with swagger
- Spring Boot HttpClient Overview
- Apache HttpClient POST HTTP Request Example
- Apache HttpClient PUT HTTP Request Example
- Apache HttpClient DELETE HTTP Request Example
- Apache HttpClient HTML Form POST Request Example
- Spring Boot JSP Exampl
- Deploying Spring Boot WAR file with JSP to Tomcat
- Spring Boot Annotations
- Spring Core Annotations
- Spring MVC Annotations with Examples
- Spring Scheduling Annotations
- Spring - Java-based Container Configuration
- Spring Java Based Configuration Example
Hibernate
- Hibernate 5 hello world
- Hibernate- One to One Unidirectional Mapping Annotation Example
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate 5 - Create, Read, Update and Delete (CRUD) Operations Example
- Hibernate Transaction Management
- Hibernate One to Many Unidirectional Mapping Example
- Hibernate One to Many Bidirectional Mapping Example
- Hibernate Many to Many Annotation Mapping Example
- Hibernate Primary KeyJoin Column
- Hibernate First Level Cache with Example
- Hibernate XML Configuration Example with Maven + Eclipse + MySQL Database
- Hibernate Java Configuration Example
- JPA 2 with Hibernate 5 Bootstrapping Example
- JPA and Hibernate Cascade Types
- Hibernate/JPA - Primary Key Generation
- Hibernate 5 - Enum Type Mapping Example
- Hibernate Component Mapping
- Hibernate Object States – Transient,Persistent and Detached
- Hibernate 5 - Save an Entity Example
- Hibernate 5 - Persist an Entity Example
- Hibernate 5 - saveOrUpdate() Method Example
- Hibernate 5 - get(), load() and byId() Method Examples
- Hibernate 5 - merge() Example
- Hibernate 5 - Delete or Remove an Entity Example
- Hibernate 5 - load() Method Example
- Hibernate Session Interface Methods
- Hibernate Session.clear() Method Example
- Introduction Of Java strutes to Architecture
- Struts 2 - Architecture
- Struts 2 - Configuration Files
- Struts 2 - Actions
- Struts 2 - Interceptors
- Struts 2 - Results & Result Types
- Struts 2 - Value Stack/OGNL
- Struts 2 - File Uploading
- Struts 2 - Database Access
- Struts 2 - Validations Framework
JAVA FX
- JavaFX Tutorial
- Introduction to JavaFX Pane
- JavaFX Popup
- JavaFX group
- JavaFX Controller
- JavaFX Gradient Color
- JavaFXAnchorPane
- JavaFXTabPane
- JavaFX Scene
- JavaFX Stage
- JavaFXWebView
- JavaFX Timeline
- JavaFX Timer
- JavaFX Image
- JavaFX Background
- JavaFX dialog
- JavaFX Font
- JavaFXTextArea
- JavaFXObservableList
- JavaFX GUI
- JavaFX FXML
- JavaFXEventHandler
- JavaFXGradle
- JavafxScrollpane
- JavaFXAPI
Abstract class in Java
In java if a class is declared with abstract keyword than it is called an abstract class. The abstract class consist of abstract method and non-abstract method. We cannot create an object in the abstract class.
Abstract has a concrete method, so the abstract class is used to achieve abstraction, but it does not provide 100% abstraction.
Here are the following points to abstract class-
- An abstract class must be declared with an abstract keyword.
- It can have abstract and non-abstract methods.
- It cannot be instantiated.
- It is used for abstraction.
- It can have a constructor and static method.
Syntax
abstract class class_name { }
Abstract method
A method that is declared without anybody within the abstract class is known as an abstract method. An abstract method can never be final and static. If a class extends an abstract class, then must implement all the abstract methods.
Syntax
abstract return_type function_name (); //No definition
Here are the following points to remember about the Abstract class and Method
- Abstract classes are not interfaces.
- Abstract classes have Constructor, Method variables and Normal methods.
- Abstract classes are not instantiated.
- When we extend an abstract class with the abstract method, we must define the abstract method in child class.
Example of Abstract class
abstract class Car{ abstract void run(); } class Maruti extends Car{ void run(){System.out.println("Running smoothly");} public static void main(String args[]){ Car obj = new Maruti(); obj.run(); } }
Output
Running smoothly
In the above example, Car is an abstract class that contains only one abstract method run. The Maruti class provides its implementation.
Another example of abstract class
abstract class Company{ abstract int Salary(); } class Developer extends Company{ int Salary(){return 50000;} } class Designer extends Company{ int Salary(){return 40000;} } class Employee{ public static void main(String args[]){ Company c; c=new Developer(); System.out.println("Monthly salary of Developer is: "+c.Salary()+" per month"); c=new Designer(); System.out.println("Monthly salary of Designer is: "+c.Salary()+" per month"); }}
Output
Monthly salary of Developer is: 50000 per month
Monthly salary of Designer is: 40000 per month
An Abstract class with a non-abstract method
Abstract classes can also have non-abstract methods along with abstract methods. But while extending the class, provide a definition for the abstract method.
Example
abstract class Car { abstract void run(); public void show() { System.out.println("this is non-abstract method"); } } class Maruti extends Car { void run() { System.out.println("Running Smoothly..."); } public static void main(String[] args) { Maruti m = new Maruti(); m.run(); m.show(); } }
Output
Running Smoothly…
This is non-abstract method
Abstraction in Java
In abstraction, it shows only functionality and hiding the complexity. Abstraction is an important feature of OOPs. An abstract class is used to provide abstraction. Simultaneously, the abstract class does not provide 100% abstraction because it can also have a concrete method.
In java, Abstraction is achieved by interfaces and abstract classes.
Example of Abstraction in Java
abstract class Vehicle { public abstract void engine(); } class Car extends Vehicle { public void engine() { System.out.println("Car engine"); //car engine implementation } public static void main(String[] args) { Vehicle v = new Car(); v.engine(); } }
Output
Car engine
Apply now for Advanced Java Training Course