create account

INTERFACE IN JAVA PROGRAMMING by leoumesh

View this thread on: hive.blogpeakd.comecency.com
· @leoumesh ·
$6.32
INTERFACE IN JAVA PROGRAMMING
Interface in Java is similar to the abstract class where you can't instantiate the class i.e. create the objects of the class. The following are the features of the interface in java:

1. All the methods within interface block are by default `public` and `abstract`.
2. In order for the interface method to work, another class needs to implement that interface using `interface`keywords.

This is a simple program demonstrating the use of `interface` in java.

```
interface A{
	void output();
}

class B implements A{
	public void output() {
		System.out.println("Printing output for Interface Class");
	}
}

public class InterfaceClass {
	public static void main(String[] args) {
		A a1=new B();
		a1.output();
	}
}

```
<hr>

The output of this code is as follows:

<center>
![Screenshot_1.png](https://images.hive.blog/DQmTWTp4bTbuY4QbWzM866ud8kKrTjhhpZwVCc7MH2i9Rwg/Screenshot_1.png)
</center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorleoumesh
permlinkinterface-in-java-programming
categoryhive-181925
json_metadata{"tags":["hive-181925","java","programming","tutorial","code","coding","learning","education"],"image":["https://images.hive.blog/DQmTWTp4bTbuY4QbWzM866ud8kKrTjhhpZwVCc7MH2i9Rwg/Screenshot_1.png"],"app":"hiveblog/0.1","format":"markdown"}
created2020-07-07 06:15:15
last_update2020-07-07 06:15:15
depth0
children0
last_payout2020-07-14 06:15:15
cashout_time1969-12-31 23:59:59
total_payout_value3.554 HBD
curator_payout_value2.767 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length898
author_reputation202,357,414,008,705
root_title"INTERFACE IN JAVA PROGRAMMING"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,384,705
net_rshares18,358,638,223,716
author_curate_reward""
vote details (32)