+ 1

what are interfaces in java

n new to java and want to learn it sincerely :)

24th Aug 2016, 5:42 PM
shivanidalmia
shivanidalmia - avatar
9 Réponses
+ 3
It is used to achieve fully abstraction. By interface, we can support the functionality of multiple inheritance. It can be used to achieve loose coupling. interface shivanidalmia{ void print(); } class A implements shivanidalmia { public void print(){System.out.println("Hello");} public static void mai n(String args[]){ A obj = new A(); obj.print(); } }
24th Aug 2016, 6:12 PM
Agha Asad Khan
Agha Asad Khan - avatar
+ 2
An interface is a reference type in Java, it is similar to class, it is a collection of abstract methods.
24th Aug 2016, 5:50 PM
Agha Asad Khan
Agha Asad Khan - avatar
+ 2
think of an interface as a contract. For instance List interface is a contract and any class that implements the interface such as ArrayList will implement the iList interface methods. Ex: public interface List {}
24th Aug 2016, 6:10 PM
Tiger
Tiger - avatar
+ 1
can u explain this with any simple example
24th Aug 2016, 5:52 PM
shivanidalmia
shivanidalmia - avatar
+ 1
oh okie..so y we use interfaces and how syntax?
24th Aug 2016, 6:03 PM
shivanidalmia
shivanidalmia - avatar
0
For example, The buttons on the front of your television set, are the interface between you and the electrical wiring on the other side of its plastic casing. You press the "power" button to turn the television on and off. In its most common form, an interface is a group of related methods with empty bodies.
24th Aug 2016, 6:01 PM
Agha Asad Khan
Agha Asad Khan - avatar
0
thank u to both of u :) nw a lil clear bout the topic just asking - which print method will b calld n y
24th Aug 2016, 6:17 PM
shivanidalmia
shivanidalmia - avatar
0
ChOOSe863usernarjampartick Guid Easdrfgim RWDWEGGFNK 😷🙂 the same thing as the name of your
24th Aug 2016, 9:03 PM
Patrick Wallace
Patrick Wallace - avatar
0
hi
25th Aug 2016, 12:21 AM
Emad Moftah
Emad Moftah - avatar