We can achieve the same functionality as interfaces by using abstract classes, So why java doesn\'t allow the following code?
abstract class Animals
{
pu
I agree with you(if i understood about what you are talking :) )this is no need of such specific naming conventions.
interface pet
{
public abstract void pet();
}
interface pet1
{
public abstract void pet1();
}
class TestTt implements pet,pet1
{
public void pet()
{
System.out.println("this is method of pet interface");
}
public void pet1() {
System.out.println("this is method of pet1 interface");
}
public static void main(String a[])
{
pet obj=new TestTt();
pet1 obj1=new TestTt();
obj.pet();
obj1.pet1();
}
}
Now, Here if abstract class allows me to create object .then, i can create 2 different references for 2 abstract classes as in interface i can do.
If so, do i need Interfaces...?