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 >> Java-Related >> Java-J2EE
 
  Core-Java (1203)  Advanced-Java (263)  Swing (41)  EJB (124)  Servlets (203)
  Struts (134)  JDBC (159)  JMS (4)  SunOne (3)  J2EE (27)
  Weblogic (34)  Websphere (3)  Java-Networking (17)  Java-J2EE-AllOther (58)
 


 

Back to Questions Page
 
Question
Can I create any Marker Interface? If yes then how can I 
use it???
Rank Answer Posted By  
 Question Submitted By :: Tathagata
I also faced this Question!!   © ALL Interview .com
Answer
there is no difference between blank inerface and marker 
interface 
yes we can creae our own marker inerface
interface Xyz
{
}
but is this work for us like a serializable and cloneable 
marker inerface 
i don't know  so please  
you do one thing to do your own interface to check only 
through the insanceof operator in a clsses those implemen 
this interface
thanks                                          amit singh
amitsing2008@gmail.com
 
0
Amit Singh
 
 
Question
"we cannot create an object of interface but we can create 
a  variable of it".diacuss the statement with the help of 
an example.
Rank Answer Posted By  
 Question Submitted By :: Simchaggar
I also faced this Question!!   © ALL Interview .com
Answer
1. Suppose interface interfaceDemo.java is as below

interface interfaceDemo {
    public void methodA();
    public void methodB();
}

2. Suppose class InterfaceDemoMain.java is as below

class InterfaceDemoMain implements interfaceDemo {
    public void methodA() {
       System.out.println("Inside methodA");
    }

    public void methodB() {
       System.out.println("Inside methodB");
    }

    public void methodC() {
       System.out.println("Inside methodC");
    }

    public static void main(String[] ar) {
       InterfaceDemoMain idm = new InterfaceDemoMain();
       interfaceDemo id;
       id = idm;
       id.methodA();
       id.methodB();
       id.methodC();// error
       idm.methodC();
    }
}

3. Here id.methodC(); will give error, only methods declared
inside interface are accessible to interface reference.
 
0
Guest
 
 
Answer
yes we can create a variable in inerface 
and i will be constant 
mans to say that hey will be static and final
inerface Xyz
{
public static final i = 12;
public static final j = 20;
}
 class Amit implements Xyz
{
psvm(String [] args)
{
Xyz k = new Amit();
System.out.println("value of var1 " + k.i);
Sysem.out.prinln("value ofd var 2 " + k.j);
}
}
Thanks                                ami singh
(amitsing2008@gmail.com)
 
0
Ami Singh
 
 
 
Question
could you run the java program without main method?
Rank Answer Posted By  
 Question Submitted By :: Naga
I also faced this Question!!   © ALL Interview .com
Answer
yes,we can write and run a java program without using the
main method.
i.e By using static

example program...!

public void static( )
public class
{
public void static( )
{
System.out.println( "Without main method" );
System.exit(0);
}
}
 
0
Naga
 
 
Answer
yes you can run java peogram without main 
we do it through the static block ,because its execute 
before the main method,
so when the class is loaded it will execute before main
but whrn the static block excute and after exiting it jvm 
search for main when it will not fou8nd it then it throw 
some exception so for this we use the 
System.exit();
class Moon
{
static
{
System.out.println("hello i am visible without main");
}
System.exit();
}
Thanks                                            amit singh
                                               
amitsing2008@gmail.com
 
0
Amit Singh
 
 
Answer
please put the System.exit(0) in static block thanks
class Moon
{
static
{
System.out.println("hello i am visible without main");
System.exit();
}
}
amit singh 
amising2008@gmail.com
 
0
Amit Singh
 
 
Question
Accenture NJ mostly ask question on Collection like
1)How to sort Objcts and how treeset sort them
2)Explain mechanism of Hashcode finding in Java
3)Name some of the Sorted collection.
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
The answer to all this question is easy but i think they 
want answer from internal mechanism how it works inside 
Java!!!
You think you answered well but they will always fail you 
just hate then
 
0
Guest
 
 
Answer
1)How to sort Objcts and how treeset sort them
Ans: *) We can sort objects using comparable and comparator
interface.
*) Treeset sort object using comparable interface.  
2) Explain mechanism of Hashcode finding in Java
Ans: 
1) Write [ java *Class name* ] = you will get class name and
hashCode no.
2) Implement the hashCode method in your class and call
hashCode method.
3) Name some of the Sorted collection.
Ans: 
1) TreeSet
2) TreeMap
 
0
Aditya Sharma
 
 
Question
We can write any Java Logics in our JSP. Then why we are 
using servlets(Controller Layer) to interact with the DAO ?
Rank Answer Posted By  
 Question Submitted By :: Shiva
This Interview Question Asked @   TCS
I also faced this Question!!   © ALL Interview .com
Answer
JSPs are translated into Servlets which renders data from
the DAO/Back-End classes on the client page. The job of
Servlet/Servelet Container is to facilitate/give developer
an option to manipulate what servlet container does as well
as use the request/response/session etcetera objects.
 
0
Kaushik
 
 
Answer
yes you are right but why we write all the business logic in
jsp ,becuse we just in a first step to follow the mvc 
architectuer like in struts so thats why we don't want to 
write java code in jsp 
we just use jsp for a view and he servlet for the 
controller for business logic
oherwise you wan o right all business in jsp so is up to you
noone sop you do this
thanks                                amit singh
amitsing2008@gmail.com
 
0
Ami Singh
 
 
Question
What is Three tier architecture. Can anyone explain with a 
Ordinary web application Project? (JSP,Servlets,JAVA,DAO) ?
Rank Answer Posted By  
 Question Submitted By :: Shiva
This Interview Question Asked @   TCS
I also faced this Question!!   © ALL Interview .com
Answer
Three tire architecture as Module View Controller.   

Tier 1: the client contains the presentation logic,
including simple control and user input validation. This
application is also known as a thin client.
[Jsp]

Tier 2: the middle tier is also known as the application
server, which provides the business processes logic and the
data access.
[Servlets, Java, DAO]

Tier 3: the data server provides the business data.
[Database]
 
0
Aditya Sharma
 
 
 
Back to Questions Page
 
 
 
 
 
   
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