

Multiple inheritance is not allowed in java and a class can only extend one parent
class. Interfaces provide a form of multiple inheritance. Interfaces are not classes,
however an interface can extend more than one parent interface.
Interfaces provide a form of multiple inheritance. A class can extend only one other class.
Interfaces are limited to public methods and constants with no implementation.
Check out our website:
Follow Telusko on Twitter:
Follow on Facebook:
Telusko :
Navin Reddy :
Follow Navin Reddy on Instagram:
Subscribe to our other channel:
Navin Reddy :
Telusko Hindi :
Subscribe to the channel and learn Programming in easy way.
Java Tutorial for Beginners:
C Tutorial Playlist :
Android Tutorial for Beginners Playlist :
XML Tutorial :
Design Patterns in Java :
Socket Programming in Java :
Spring MVC Tutorial :
OpenShift Tutorial for Beginners :
Spring Framework with Maven :
Sql Tutorial for Beginners :
String Handling in Java :
Array in Java :
Java Servlet :
Exception Handling in Java :
source
Oh bee jey
But why use an interface? If I delete the interface all that does is shorten my code, which is good! so whats the use of an interface?
Your videos are just outstanding….we get to know new concepts in very less time as compared to other videos
Woo
👌
still quite confuse…
Well done ! Keep on …
Great explanation. Thank you so much! You're an outstanding tutor. Well structured video, concise and informative, as usual.
I was trying to put variable in interface; but, i cant just declare it; i have to define it as well
sir thank you very much !!! You are best teacher!!!
3:57 it's not xyz it's Pqr
Am I right ?
I was finding this from long time , finally got that from you , very very thanks….
Fantastic
@telusko , please upload videos on java io
u r doing a great job,one suggestion if u can upload all the tutorial program that u have used in the video on github
interface abc{
void show();
}
class abcImp implements abc{
void show(){
System.out.println("show");
}
}
class telusko{
static void main(){
abc o=new abcImp();
o.show();
}
}
// what is the problem with this code??
error:show() in abcImp cant implement show() in abc.
please replya t the earliest
As you said in your earlier video on interface that we cannot create an object of interface so out here while using anonymous inner class why are you creating on object of the interface Abc?
sir can u tell me the question which will ask durin interview on interface?
Thanks for your great tutorials
Excellent explanation.
how are u recording this at 7:10am?????? i can barely spell my name that time
I Have a query…. pls chk the program…. Its a interface …but we can define also….. how its possible…
public interface Test2 {
void hello();
int Hi();
static void Hey() {
System.out.println("Hey….");
}
abstract void Abc();
public static void main(String[] args) {
Test2 t2 = new Test2() {
@Override
public void hello() {
System.out.println("…its a Hello Method");
}
@Override
public int Hi() {
System.out.println("Return Zero");
// TODO Auto-generated method stub
return 0;
}
@Override
public void Abc() {
System.out.println("Its a Abc method");
}
};
t2.hello();
t2.Abc();
t2.Hi();
Test2.Hey();
}
}
Sir can we have variable in Interface
hello sir….nice video
Sir can it possible that interface class method can define differently where different classes implements it.
Everyone? hv i heard everyone?? where's alien?
I learned something I had not understood before! This was a good use of my time, thank you very much!
Subscribing.
what is the point with the interfaces ? I cant see functionality of this one. The Interface is created to inform me about some name of methods which I must to use and implement. And where is the sense? I use some classes with my method regardless, if I implements interface or not.
Hi Navin,
I have a question regarding interface which I stumbled upon while working on exception. This is an example from Head First Java Book. Below is the code.
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequencer;
public class MusicTestException {
void play() throws MidiUnavailableException{
Sequencer seq = MidiSystem.getSequencer();
System.out.println(seq.getClass().getName());
System.out.println("we got Sequencer");
}
void sendTxt(){
}
public static void main(String[] args) {
// TODO Auto-generated method stub
MusicTestException mte = new MusicTestException();
try {
mte.play();
} catch (MidiUnavailableException e) {
// TODO Auto-generated catch block
System.out.println("execption " + e);
}
}
}
Here I couldn't understand how MidiSystem Class can have a static method getSequencer of type Sequencer when MidiSystem Class doesn't implement the Sequencer Interface at all. here is the piece of code "Sequencer seq = MidiSystem.getSequencer();" This is bit confusing to me. When I looked into Java API for MidiSystem class where i never found the Sequencer implementation but in the code it says it can Instantiate Sequencer and getSequencer returns to interface. How is this possible? Please help me here.
Hello Sir, I have 1 question…ur saying interface is use to do multiple inheritance. But my question is in inheritance the method is already implemented we inherit the class and just reuse the method instead of rewrite it again….but in interface the child class has to implement the method…so where is the benefit of using interface if i have to implement the mhod in child class…
The way you teach java its just amazing. Thanks a lot.
Loved it! Simply great 🙂
Can you make a tutorial series on Scala Programming? Your tutorials are really helpful. Thank you for your effort. You make learning really easy and accessible.
very good vids
are you jesus?
i like the way you explain these examples, it is very creative..
when there are more than 1 method in interface then how to use lambda expression
+Telusko learnings…can u suggest something abt this error…
class A{
int i=5;
}
interface B{
int i=6;
}
class C extends A implements B{
public void show()
{
System.out.println(i);
}
}
class main{
psvm(String…a){
new C().show();
}}
this program shows ambiguos error. Can any1 explain it??
Thank you