Selasa, 04 April 2017

How abstract keyword is used in programming

Creating abstract methods Sometimes while creating hierarchies, a method inside a super class might not be suitable to have any kind of implementation. Such methods can be declared as abstract using the abstract keyword. Syntax for creating an abstract method is as follows: abstract return-type method-name(parameters-list); As candidate example for abstract method let’s consider the Shape class from our previous article: 1 2 3 4 5 6 7 class Shape { void area() { System.out.println(“Area of shape”); } } In the above example there is really no need to give implementation for the area() method. Area of shape doesn’t mean anything without telling

The post How abstract keyword is used in programming appeared first on Coding Security.


How abstract keyword is used in programming
read more

Tidak ada komentar:

Posting Komentar