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
 
 


 

Back to Questions Page
 
Question
what is business objects?
Rank Answer Posted By  
 Question Submitted By :: Gopal
I also faced this Question!!   © ALL Interview .com
Answer
Business objects means REAL OBJECTS which u think   in ur 
problem space.... i wil give a example.....In a room u 
should identify different Business Object's we can 
identify  FAN....Bcoz Fan is an OBJECT which hav Business 
Data like Speed and Business Methods like Rotate 2) Air 
Conditioner is an Business Object and it speed is Business 
data and LCD also and compressor is Bussiness object and 
Remote is an INTERFACE
 
0
Ershad Md Sk
 
 
Question
what is session facade ?
Rank Answer Posted By  
 Question Submitted By :: Gopal
I also faced this Question!!   © ALL Interview .com
Answer
It is Design pattern
Problem:too many method invocations b/w client and server 
will lead to network overhead,tight coupling due to 
dependencies between the client and server and chance of 
misuce of server business methods due to fine grained 
access etc.
Solution: Use of session besn as facade to encapsulate the 
complexties b/w the client and  server interactions. The 
session facade manages the business objects and provides a 
uniform coarse grained service access layer to client.
 
0
Srikanth Nallapaneni
 
 
Answer
Its a Dessign pattern.It is used on business tier to access 
the other EJBs(Session ,Entity)means other part of the 
system to reduce the networkflow.It provides the one point 
of view to the client.
 
0
Srinivasa
 
 
 
Question
class A{
     some variables;
     public void a()throws Excepion1,Exception2{....}
}
class B extends A{
variables...
public void a()throws E2,E3{.....}
}
Qns:
   here override of methods occurs or not,ore else wil give 
any compilation error or run properly..plz tell me briefly 
whts happening with the above codes....
Rank Answer Posted By  
 Question Submitted By :: Saumyaranjandash
This Interview Question Asked @   Quinnox
I also faced this Question!!   © ALL Interview .com
Answer
It is a good programming practice to have only a sub set of
checked exceptions classes from the throws clause of the
inherited method of the superclass.


Here in the above example E2,E3 exception are not a subset
of the exception classes of the inherited method
 
0
Jeevan
 
 
Answer
this will throw complie error b'coz u r overirding the 
method & u overirdng method cant throw exceptions which is 
not being thrown by overirded method hwevr ovrindng method 
can throw runtime exceptions
 
0
Dipesh
[Cambridge]
 
 
Answer
Overriding methods cannot change the signature of the 
overridden method. but runtime exception r not present in 
signature so u can only add the runtime exception in 
overriden method.
 
0
Sunita
[Cambridge]
 
 
Question
Need 2+ yrs experienced java techinical question papaer for 
company Iflex
Rank Answer Posted By  
 Question Submitted By :: Shripriya
I also faced this Question!!   © ALL Interview .com
Answer
just search in net u will find lot a questions
and companies does not ask questions depending on 
experience it asks depends on the technologies in your CV 
so be thorough with the technologies in your CV
 
0
Mkcreddy
 
 
Question
What is  Ideal Design of Class?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
declare variables as Private and methods which accesses 
variables as public.
 
0
Venkat
 
 
Answer
Ideal Design of Class is First identity Different Business 
Objects and identity Business Data & Business Methods on 
which u r working on............Think U are working on 
SHAPE class think shape is an object and Draw & erase are 
business methods which u should Operate ON..And shape has 
Different data objects like Square,Rectangle
 
0
Ershad Md Sk
 
 
Question
how can u handle run time exception in java? explain with 
brief explanation with examples?
Rank Answer Posted By  
 Question Submitted By :: Jawahar
This Interview Question Asked @   CTS
I also faced this Question!!   © ALL Interview .com
Answer
public class ExceptionalClass {
public void method1() throws CheckedException {
        // ... some code
        throw new CheckedException( "something bad 
happened" );
}
    public void method2( String arg ) {
        if( arg == null ) {
            throw new NullPointerException( "arg passed to 
method2 is null" );
}   
}
public void method3() throws CheckedException {
    method1();
}
}  

            Contrast method1() with method2(). When you 
make a call to method2(), you don't have to do so within a 
try/catch block. Since you do not have to catch the 
exception, the exception is said to be unchecked; it is a 
runtime exception. A method that throws a runtime exception 
need not declare the exception in its signature.
 
0
Pavithra
 
 
Answer
Runtime exceptions represent problems that are detected by 
the runtime system. This includes arithmetic exceptions 
(such as when dividing by zero), pointer exceptions (such 
as trying to access an object through a null reference), 
and indexing exceptions (such as attempting to access an 
array element through an index that is too large or too 
small). 

Runtime exceptions can occur anywhere in a program and in a 
typical program can be very numerous. Typically, the cost 
of checking for runtime exceptions exceeds the benefit of 
catching or specifying them. Thus the compiler does not 
require that you catch or specify runtime exceptions, 
although you can.
 
0
Pavithra
 
 
Question
how can you retrive information from database by using 
hashmap/arraylist ,plz explain with example briefly?
Rank Answer Posted By  
 Question Submitted By :: Jawahar
This Interview Question Asked @   Satyam
I also faced this Question!!   © ALL Interview .com
Answer
import java.util.*;
import java.sql.*;

public class Jdbc
{
 public static void main(String[] a)
  {
    Connection conn=null;
    try
     {
       String s1="Driver name for registration";
       Class.forname(s1);
       String url="Driver Port No name";
       String username="Database Username";
       String password="Database password";
        
conn=Drivermanager.getConnection(url,username,password);
String sql="SELECT name,address FROM tb"
Statement stmt=conn.createStatement(sql);
Resultset rs=stmt.executeQuery();

ArrayList al=new List();
while(rs.hasnext())
{
  al.add(index,rs.getString());
}
rs.close();
stmt.close();
conn.close();
}
//handle Exceptions
}
}
 
0
None
 
 
Question
Thanks  A.jyotsna,
Can u tell me differnce between abstract class and interface

                                  vikash
Rank Answer Posted By  
 Question Submitted By :: Vikash
I also faced this Question!!   © ALL Interview .com
Answer
Abstact class can have both concrete and non-concrete 
methods where as interface has only non-concrete methods. 
Unlike interface, Abstract calss can contain fields that 
are not static and final.
 
0
Sridhar
 
 
Answer
Difference Between Abstract Classes and Interfaces
Abstraction - A way to provide a view to an object
In real life we have examples like resume,hotel menu, 
trailer of a movie as examples for abstraction.  They 
provide an insight into the other object.
Abstract classes and Interfaces are implementation of 
abstraction.
abstract class - when u want to create classification or 
hierarchy of classes, u can use inheritance and generally 
your parent classes would like to impose certain compulsory 
behavior along with some free behaviours.  in such a case 
the compulsory behavior to be declared as abstract, there 
by the class should also be declared as abstract, so the 
right place for abstract class is only in the case of 
inheritance.
Interface - Interface are more related to roles, like for 
example, u r a kind of human, and u r playing the role of a 
programmer,  here human could be a abstract parent class 
and programmer could be a interface.
In real life all roles carry compulsory behaviors and if 
you want to get into some role, then it is compulsory to 
implement all the methods of the role.
"The world is a stage, every one is a actor, every actor 
carries a mask, and when the mask changes the role changes, 
and when the role changes the behaviour changes"
The roles are interfaces - u know very well one person can 
carry many roles, so one class can carry many interfaces 
but it can belong to only one classification.  Thats why 
multiple inheritance is allowed for interfaces and not 
allowed for abstract or concrete classes, 

Happy!!! - want to know more fundas - contact me - 
Shoiab - 9840135749 - Haaris Infotech - The Java Trainers - 
Chennai
 
0
Mohammad Shoiab
[Thomson Digital]
 
 
Answer
Abstract class:- 
1. if we declare ny class as a abstract, then we can't 
create an object/instace of that class explicitly.
2.afbstracts class may or may not contain abstract method.
3. if on declare any method as an abstract, then the class 
should be declared as abstract.
4.if a method is declared as abstract in abstract class, 
then child bound to define the abstract method of parent.
5.abstract class may contain constructor.
6.abstract class may hold the child object.
Interface class:-
1.by default all method be abstract.
2.class can implements more than one interface class.
3.child should give the body of all method of interface 
class, but if a child class with abstract keyword, then nod 
need to give the body of interface classes method.
4.interface can't create objects but can hold the object of 
child.
5. variable in interface class are by default public, 
static and final.
6.we can't use the final, static, native,synchronous 
keyword with the methods define in interface.
7. we can't declare interface as final.


if any question have, tell me at rkjhaw@sify.com or 
info@shandilya.org
 
0
Rakesh Kumar Jha
[Thomson Digital]
 
 
Question
What is difference between Iterator and for loop
Rank Answer Posted By  
 Question Submitted By :: Vikash
I also faced this Question!!   © ALL Interview .com
Answer
The Iterator is not implemented as an
indexed loop, at least not in Sun Java. The collection 
always has a
getter armed with the iterator's next value. Much of the 
collection's
internal implementation is done via the iterator. But the 
pieces of
ArrayList that are optimized for speed, skip bounds 
checking and use int
array offsets to do their work.
I would like to know what is the difference between these 2.
>
> ArrayList list = new ArrayList
>
> for(int i=0; i<list.size(); i++){
> //do stuff
> }
>
> Iterator i = list.iterator();
>
> while(i.hasNext(){
> do stuff
> }
 
0
A.jyotsna
 
 
Answer
Iterator is used in Collection objects,but for is used for 
variables.
 
0
Srikanth Nallapaneni
[Thomson Digital]
 
 
Answer
In iterator the remove() is available to remove the
content/item but in for loop  remove() not available.
 
0
Vijayakumar Chinnasamy
[Thomson Digital]
 
 
Answer
The major difference is Iterator doesn't output the list we 
are iterating in sequence.
where as in for we structure it to print in sequence.
 
0
Sundarakannan D
[Thomson Digital]
 
 
Question
what is difference between throw and throws in exception?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
"throw" is used to handle user-defined exception.
JVM handles the exceptions which are specified by "throws"
 
3
Neema
 
 
Answer
throws is used to throw an exception from the  method 
without handling  that exception where as 'throw' is used 
to throw the exception to catch block and handle it.
 
3
Pavithra
 
 
Answer
throw is used for to through exception system explicitly,and
throws is u sed for to throws exception means throws
ioexception and servletexception and etc.........
 
0
Shiva
 
 
Answer
hi pavitra u r nswer is wrong
 
0
Shiva
 
 
Answer
throw will throws the exception,
and throws declares that the function will throw an exception
you should catch all every functions throwing and exception
u declare it or catch it
 
0
Chirag
 
 
Answer
throws keyword is used 2 delegate the responsibility of 
exception handling 2 caller method where as throw keyword 
used 2 hand over the creted customised excetion object 2 
jvm 2 handle the excepion.
 
0
Srinath
 
 
Answer
throws --> throws declare that it throws the exception to 
the calling method.

throw -->  it is surrounded by the try catch block actually 
it does the work, of throwing the exception.

For Example:

public void testMethod() throws BusinessException
{ 
  try
    {
    }
   catch(Exception exe)
   {
     // catch all the exceptions and provide some meaningful
        message
      throw BusinessException("An error occured while     
trying to connect to DB");
   }   
         
}
 
0
Raj
 
 
Answer
throws:
Method capable of raising an exception but not handling the 
same. i.e to say no Try Catch block is implemented in the 
Method, to handle the exception.
The callers should create the Try Catch Block to safeguard 
against the exception.
If the above is not followed it would result in Compilation 
errors.

throw:
The method that raises the exception also handles the same 
in its Catch block.
If unhandled the exception can also be handles by the 
Callers Try Catch Block.
Hope this makes sense.
 
0
Anu Mathew
 
 
Answer
throw- means user defined exception. we want throw manually
throw the exception.
throws- means jvm going to take all exception.
 
0
Velayutham
 
 
Answer
In Throws, what ever the exception you are declaring are 
handle by JVM. If it is a user defined exception in throws 
block, JVM doesn't know when to throw that exception. For 
this purpose we use Throw for a certain conditions/logic to 
throw these user defined exceptions.

I think the above makes sense.
 
0
Chandra Sekhar
 
 
Answer
throws specifies that a method could throw an exception 
while throw is used to throw a particular type of exception

throw  IOException;

public void clem()throws exception
 
0
Clement
 
 
Answer
throw : throw is used to throw user defined exceptions.
        For ex: MyException written by user.it may be either
        checked or unchecked exception.

throws: throws is used to throw exception those are handled by
         JVM directly.
         throws is used in method declaration to 
         intimate user that, it throw the exception that must 
         be handled by calling method.

Note :use throws when your method does not handle exception.
 
0
Raju
 
 
Answer
throw : throw is used to throw exception by user whenever he
        feels to throw exceptions. throw is used to throw 
         either user defined or runtime exception.
         for ex : throw new MyException(), here MyException 
                  is user written exception.
                  throw new NullPointerException(), here 
                  NullPointerException is RuntimeException.

throws: throws is used by the method to throw exception to
        the calling method. And method itself does not able
        to handle it so it throws to calling method.
 
0
Raju
 
 
Answer
throw - It is used to throw an Exception.
throws - This is used to specifies that the method can 
throw Exception
 
0
Prasanna
 
 
Answer
throws is used for throwing an exception from a method to 
jvm, the jvm should handle it.where us throw is used when 
user needs to raise his own exception.
 
0
Lokesh
 
 
Answer
throw: It is used to explicitly or manually throw an 
exception.it can throw user defined exceptions.

throws:It tells that exception to b handled by calling 
function. It tells caller that what exception that method 
could throw.
 
0
Manu
 
 
Question
what ide u r using and wat version, how wil u build the
project etc ?
Rank Answer Posted By  
 Question Submitted By :: Suja
I also faced this Question!!   © ALL Interview .com
Answer
iam using myEclipse ide,in java tht is 6.0 version tht 
depends on ide.
 
0
A.jyotsna
 
 
Answer
I m Using Eclipse Build Tool & i m In JRE(Java Runtime 
Enviroment) 6.0 Version ...Be CareFul He May Ask The Diff B/
W JDK & JRE.....JRE Is Runtime Time EnvironMent 1)JRE 
includes every thing that is part of java when it is 
running the program (Methods ,Syntax) But JDK is not like 
that....
 
0
Ershad Md Sk
 
 
Question
what is mean by overriding in which situation we wil use?
Rank Answer Posted By  
 Question Submitted By :: Rajmohan
This Interview Question Asked @   Atlas-Systems , Csc
I also faced this Question!!   © ALL Interview .com
Answer
If we have same method name in the super class as well as 
in the sub class, then the method in the subclass is said 
to override the method in the super class.
 
1
Neema
 
 
Answer
override methos have same method name with same 
signature.which methods are apper in super class to sub 
class.
 
1
Ramana
 
 
Answer
Overriding means, In a derived class, if we include same
method name, with same number & types of parameters and
return type as a method already defined in the base class,
then the method is said to be Overridden.

base class:

class Circle {
protected double radius;

public double getArea() {
return Math.PI*radius*radius;
   }//this method returns the area of the circle
}

derived class:

class Cylinder extends Circle {

protected double length;

public double getArea() { // method overriden here
return 2*super.getArea()+2*Math.PI*radius*length;
    }//this method returns the cylinder surface area
}
 
0
Vikas
 
 
Answer
According to J2ee Compleet reference java:
I Think the  answer is that
Overriding means the : In inheritance  If we Declare the
(Public of default)  Method in the superclass Similarly we 
declare the method with the same name ,Same type,same 
number of parameters.but the Body of the method May 
different When We Instansiate child class and access it 
then child's method will called if u want to call super's 
overriden method then use the [super()] method to access it 
in child  for this read [Java compleete reference's 
Chapter#8] u will find reasonable answer
 
0
Shahbaz Ali
 
 
 
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