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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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 a instance for intwerface?
 Question Submitted By :: Bhaskar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: can we create a instance for intwerface?
Answer
# 1
No.We cannot create instance for interface.But we can 
create reference to an interface.We can implement the 
interface by creating sub class(implementation class) and 
creat instance to the sub class, then you can create 
reference to the interface by assigning instance of sub 
class to the interface reference variable.
 
Is This Answer Correct ?    4 Yes 0 No
Subhash
 
  Re: can we create a instance for intwerface?
Answer
# 2
no.Interface is similar to class but they lack instance 
variable, their methods are declared with out any body. 
Interfaces are designed to support dynamic method 
resolution at run time. All methods in interface are 
implicitly 
abstract, even if the abstract modifier is omitted. 
Interface methods have no implementation;
 
Is This Answer Correct ?    2 Yes 0 No
Uma
 
 
 
  Re: can we create a instance for intwerface?
Answer
# 3
Though it is correct that interfaces are basically used for 
obtaining the dynamic resoulution of the Method and they 
usually can not be instantiated but it is also possible to 
instantiate the same in case of anonymous classes and it 
works fine.......


class Amit 
{

         void addCode()
         {
               Runnable rr=new Runnable()
               {
                   public void run()
                   {
             System.out.print("This is Amit")             
          }
               };
            Thread tt=new Thread(rr);
             tt.start();
             
         }
}

class Check
{
    static public void main(String[]amit)
    {
             new Amit().addCode();
    }
}
 
Is This Answer Correct ?    0 Yes 0 No
Amit Kumar Gautam
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
is this possible to create an array of 0 length? if so how? if not so why? coz we have an array in main() likw this "static void main(String [] s) then what it signifies? Hexaware2
Java violates few objected oriented concepts. Can you explain in what way? Ness-Technologies3
what is mean by method signature? Satyam6
y cant i declare method like public final static show()  2
Can applet in different page/s communicate with each other?  1
How is Garbage collection done in Java? T3-Softwares2
What is thin driver and thick driver. why it is called so? Logisoft1
In Java why we write public static void main(String args[]) why not main()? TCS12
How to reduce flicking in animation? TCS1
Can we access private data outside of the class directly in java programming language? Why There is no runtime checking in java, which leads to access the private data directly outside of a class? Google2
What is an object?s lock? Give name of object?s that have locks?  1
What is difference between Iterator and for loop  4
What is the difference between overloading and overriding a function? Infosys7
Can u write constructor in abstract.If yes den when it will be invoked. SunGard3
whats the diff between jsp and servlets? HCL9
What is Remote Interface ? CTS4
how to print output with out using sop statements UHG3
write a progam hashmap & hashtable? IBM2
what is Inheritense Tech-Mahindra1
What is compile time polymorphism? Elementus-Technologies6
 
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