For the post on interface, please click [here](). There are many ways to work with interface in java basically to remove the unnecessary code. Here's a program to showing two of these. ``` package Polymorphism; interface A{ void output(); } public class InterfaceClassLambda { public static void main(String[] args) { A obj=new A(){ public void output() { System.out.println("Hello World"); } }; obj.output(); } } ``` <br> Or you can work with interface through a mechanism known as Lambda Expression, where you can create function without requiring a class. ``` interface A{ void output(); } public class InterfaceClassLambda { public static void main(String[] args) { A obj= () -> System.out.println("Hello World"); obj.output(); } } ``` Both will show the same output when executed.
author | leoumesh |
---|---|
permlink | another-way-of-working-with-interface-in-java |
category | hive-122108 |
json_metadata | {"tags":["hive-122108","java","coding","porgramming","code","education","tutorial","oops"],"app":"hiveblog/0.1","format":"markdown"} |
created | 2020-07-07 15:18:30 |
last_update | 2020-07-07 15:18:30 |
depth | 0 |
children | 1 |
last_payout | 2020-07-14 15:18:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.227 HBD |
curator_payout_value | 1.020 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 832 |
author_reputation | 212,340,493,251,438 |
root_title | "ANOTHER WAY OF WORKING WITH INTERFACE IN JAVA" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,391,385 |
net_rshares | 7,311,097,149,890 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tombstone | 0 | 14,100,856,678 | 0.67% | ||
themarkymark | 0 | 1,796,966,105,099 | 9% | ||
tykee | 0 | 2,869,049,341 | 50% | ||
maulida | 0 | 457,017,947 | 100% | ||
buildawhale | 0 | 4,215,089,527,627 | 9% | ||
therealwolf | 0 | 640,487,193,926 | 2.25% | ||
makerhacks | 0 | 20,552,109,718 | 9% | ||
smartsteem | 0 | 131,132,275,209 | 2.25% | ||
kamchore | 0 | 149,186,805,731 | 100% | ||
upmyvote | 0 | 6,422,472,220 | 9% | ||
bala41288 | 0 | 39,728,903,417 | 20% | ||
leoumesh | 0 | 31,967,949,266 | 100% | ||
ipromote | 0 | 2,205,705,714 | 9% | ||
digital.mine | 0 | 182,010,074,048 | 1% | ||
jk6276 | 0 | 29,022,314 | 1% | ||
laissez-faire | 0 | 9,730,254 | 100% | ||
epicdice | 0 | 4,301,637,105 | 0.67% | ||
tinyhousecryptos | 0 | 532,369,388 | 5% | ||
gitplait | 0 | 71,927,622,279 | 100% | ||
hivecur2 | 0 | 1,120,722,609 | 3% |
Thanks for sharing an other Java tutorial. I would request you to share your previous link in new post as it will be helpful for java enthusiast to see your other amazing tutorial. <sub> Your post has been submitted to be curated with @gitplait community account because this is the kind of publications we like to see in our community. </sub> Join our [Community on Hive](https://hive.blog)
author | gitplait-mod1 |
---|---|
permlink | qd3uyp |
category | hive-122108 |
json_metadata | {"users":["gitplait"],"links":["https://hive.blog"],"app":"hiveblog/0.1"} |
created | 2020-07-07 15:28:03 |
last_update | 2020-07-07 15:28:03 |
depth | 1 |
children | 0 |
last_payout | 2020-07-14 15:28:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 394 |
author_reputation | 64,455,719,431 |
root_title | "ANOTHER WAY OF WORKING WITH INTERFACE IN JAVA" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,391,530 |
net_rshares | 0 |