ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
can we create instance for interface in java?
 Question Submitted By :: Guru
I also faced this Question!!     Rank Answer Posted By  
 
  Re: can we create instance for interface in java?
Answer
# 1
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 ?    4 Yes 3 No
Guru
 
  Re: can we create instance for interface in java?
Answer
# 2
You can not instantiate an interface,however, u can create 
its reference variabe.

You can just assign an object of a class (implementing the 
interface) to the reference variable of the interface.
 
Is This Answer Correct ?    11 Yes 1 No
Jyotisubhra Ghosh
 
 
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
can we add two numbers without using arthematic operators? if possible how?  2
What are different type of access modifiers?  3
Difference between Web-based applications,Client- Server applications and Distributed applications? Infosys2
garbate collector(GC)?  4
Difference between JDK, JRE, JVM Oracle5
when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)dopost() d)service Accenture1
what is the replacement for GOTO in java? CTS2
Instead of writing Home, Remote Interfaces if i directly extends EJBObject to bean class what happens? Flextronics1
Program to output as below formate: 1 2 3 4 5 6 7 8 9 10 Huawei2
what is hashmap& hashtable with example? CTS1
What are the traverses in Binary Tree? Adobe2
What are the ways of polymorphism other than Overridding & Overloading  1
What are wrapper classes? Noah-Solutions6
where lives in jvm  3
what is inner class? HCL5
what Data encapsulation in java?  4
what is java Tech-Mahindra1
Hi friends, i am new to java. can you explain how java is secured.  1
what is difference between servletconfig and servletcontext? AMDOC3
what is the difference b/w design pattern and architecture Covansys2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com