The java compiler adds public and abstract keywords before the interface method.

Java Programming Language Abstarct class and Methods in java (Article) Abstarct class and Methods in java (Program)

3850

Program:

<span class="pln">
</span><span class="kwd">interface</span><span class="pln"> </span><span class="typ">Human</span><span class="pun">{</span><span class="pln">
</span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">abstract</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> name</span><span class="pun">();</span><span class="pln">

</span><span class="com">/*The java compiler adds public and
 abstract keywords before the interface method.
 */</span><span class="pln">

</span><span class="pun">}</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Woman</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">Human</span><span class="pun">{</span><span class="pln">
	</span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> name</span><span class="pun">(){</span><span class="pln">
		</span><span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"I am Your Mother"</span><span class="pun">);</span><span class="pln">
		</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> main</span><span class="pun">(</span><span class="typ">String</span><span class="pln"> args</span><span class="pun">[]){</span><span class="pln">
</span><span class="typ">Woman</span><span class="pln"> obj </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Woman</span><span class="pun">();</span><span class="pln">
obj</span><span class="pun">.</span><span class="pln">name</span><span class="pun">();</span><span class="pln">
 </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span>

Output:

I am Your Mother
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.