Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

can we create instance for interface in java?

Answer Posted / guru

interface call2
{


void get1();
int a=8;
}


interface call extends call2
{


void get();

}



class interex implements call,call2
{

public void get()
{

System.out.println("hi");

}
public void get1()
{System.out.println("hsfwsi");}
}


class interex1
{
public static void main(String s[])
{
call e=new interex1();



e.get();
e.get1();

System.out.println(e.a);
}
}

second pgm
-----------
interface call2
{


void get1();
int a=8;
}


interface call extends call2
{


void get();

}



class interex implements call,call2
{

public void get()
{

System.out.println("hi");

}
public void get1()
{System.out.println("hsfwsi");}
}


class interex1
{
public static void main(String s[])
{
call e=new interex();



e.get();
e.get1();

System.out.println(e.a);
}
}

Is This Answer Correct ?    14 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 3 types of loops in java?

1088


How many threads does a core java have?

1078


Variables used in a switch statement can be used with which datatypes?

1001


What is the most important feature of java? What is an interface?

1019


What is the use of generics? When was it added to the Java development Kit?

1021


What is the difference between this() and super() in java?

1051


How many static init can you have?

1216


What are void pointers?

1314


Is a boolean 1 bit?

1082


What is the function of log?

1014


Why do we use regex?

1034


Can a abstract class be defined without any abstract methods?

1007


Can you give names of Container classes?

2308


What is the tradeoff between using an unordered array versus an ordered array?

1245


What are different types of states exist for a thread?

1013