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 >> Java-Related >> Java-J2EE >> Core-Java
 
 


 

Back to Questions Page
 
Question
What is Vector?Can you elaborate how Vector is Thread safe?
Rank Answer Posted By  
 Question Submitted By :: Varsha
I also faced this Question!!   © ALL Interview .com
Answer
Vector is synchronized and thread safe
it allows one thread can access at a time
 
0
Srilatha
 
 
Answer
Vector is a growable array.

The methods in Vector class are synchronized which makes
vector thread safe.
 
0
Kk
 
 
Answer
Vector is a class in collection framework which omplements 
list interface.It is one of the legacy classes in 
collection FW.As all the methods in the vector class are 
synchronised it is thread safe.
 
0
Aruna
 
 
 
Question
What is hash method?
Rank Answer Posted By  
 Question Submitted By :: Varsha
I also faced this Question!!   © ALL Interview .com
Answer
A way to insert values into a defined key accessed table. 
Most hashing methods are very efficient and have a time of O
(1).
 
0
Rajashree
 
 
Question
How multi processing is achieved in JAVA?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC
I also faced this Question!!   © ALL Interview .com
Answer
A thread pool is a collection of threads, which you 
keep "alive" and use/reuse to process incoming "tasks". 
When a new tasks arrives (a typical example is a request to 
an HTTP server) you try to find a thread from the 
collection, which is idle, and handle the task to it. If no 
such thread exists you either wait for one to become 
available or add a new thread to the pool (usually there is 
an upper limit, though). After the thread has finished 
processing the task, it is not terminated, only marked as 
idle and ready to be reused for another task.

The main advantages of using a thread pool as opposed to 
creating a new thread to handle each new task are:

1) By reusing threads you save the thread 
creation/destruction overhead.

2) You have control over the maximum number of tasks that 
are being processed in parallel (= number of threads in the 
pool).
 
0
Rajashree
 
 
Answer
by multi threading
 
0
Simran
 
 
Answer
We can achieve this in java by using Interface conscept.
 
0
Dipil T T
 
 
Answer
First of all, MultiProcessing is different from 
MultiThreading. In MultiThreading the same processor 
executes the different threads. However there is no 
parallel processing of any thread done because finally, one 
processor can handle only one task at a time. You feel the 
computer is doing many tasks together because of the very 
small amount of time between task switching but the 
processor is actually doing only a single task. But how 
fast the processor is completing all the queued tasks 
depends upon the major factor that is the clock speed and 
many others too. But when you employ more than one 
processor, as in Servers with Multiple CPUs or in the 
latest Core2Duo or Core2Quad machines, MultiProcessing 
(technically known as Parallel Computing) comes into 
picture, where each thread of the same process is assigned 
to different processors (or cores in case of the multi core 
architectures) using fork-and-join method. In this case two 
threads of the same process is parallely executed by two 
processors (in case of 2 processors). In C/C++ Parallel 
Processing (MultiProcessing ) can be achieved by using the 
OpenMP library which is shipped with the latest Visual 
Studio compilers and the other compilers like GNU v4.2 and 
above and IBM and Intel compilers. You have to write the 
programs using the appropriate #pragma statements to fork 
and join for loops and also compile the programs with 
special flags. Multiple processor or multicore cpus are 
useless unless the software you write utilizes them.
My answer does not tell you how to do the same in Java but 
you will definitely understand what to search for i.e. 
libraries supporting MultiProcessing in Java.
 
0
Sharjith N.
 
 
Question
What is Interface?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC
I also faced this Question!!   © ALL Interview .com
Answer
Interface contains Abstract methods and Final variables.
 
0
L.gururajan
 
 
Answer
interface is a method prototype
it contains method declarations and final variables
 
0
Venu
 
 
Answer
Interface is a mechanisms used to interact with or communicate with some external devices such as data base through the java application. & every interface is define with collection of abstract function.
 
0
Nikhlesh Gupta Datia (m.p.)
 
 
Answer
A boundary across which two independent systems meet and 
act on or communicate with each other. In computer 
technology, there are several types of interfaces. 
user interface - the keyboard, mouse, menus of a computer 
system. The user interface allows the user to communicate 
with the operating system. Also see GUI. 
  software interface - the languages and codes that the 
applications use to communicate with each other and with 
the hardware. 
  hardware interface - the wires, plugs and sockets that 
hardware devices use to communicate with each other.

 To connect with or interact with by means of an interface
 
0
Rajashree
 
 
Answer
Interface contains only declarations of methods and final 
variables.Which is exposed to external world that which 
methods they have to implement.External world means any 
other industry/business who is going to write software for 
application.
 
0
Akshay Odhekar
 
 
Question
How the threads are synchronized?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC , Cts
I also faced this Question!!   © ALL Interview .com
Answer
By using wait(),notify and notifyall() methods in the code.
 
0
Dsr
 
 
Answer
Threads are synchronized in two ways.

1) block level
2) Method level

Block level synhronization is the better performance 
compare to method level.

Block Level: 
see the code syntax for block level
synchronized {..
....//code to lock the specific object here..
...}

Method Level:
 See the syntax
   public void synchronized XXXMethodName(Parameters or 
object to acquire locking){.....
...}
 
0
Seshadri Pera
 
 
Question
What is advantage of using threads?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC
I also faced this Question!!   © ALL Interview .com
Answer
a)lower context switching over head.

b)shared state:
allowed concurrent instance of the server to communicate 
easily with each other

c)linux supports the POSIX thread standard
i)pthreads library.
ii)portable across most unix platform.
 
0
Rajashree
 
 
Answer
Threads means part of a program which is in execution.That
means it's very easy to implement any large and complex
application by partitioning into threads. By this we can
save memory or storage.

we can decrease time of execution
It is very easy to test as the whole code partitioned into
parts and execute
 
0
Yayati Pavan Kumar
 
 
Question
What is thread?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC
I also faced this Question!!   © ALL Interview .com
Answer
Thread is a path of the execution in a program.
 
0
L.gururajan
 
 
Answer
Thread is a light weight process.
 
2
Avijit
 
 
Answer
Thread is a sub-process.
 
0
Lavanya
 
 
Answer
Thread is a independent sequential of program.
 
0
Dsr
 
 
Answer
A thread is a part of program that follows a separate path of execution.
A thread is also called a light weight process as they share common resources
 
0
Naveen
 
 
Question
What is casting?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC
I also faced this Question!!   © ALL Interview .com
Answer
Casting is a mass production process which involves molten 
materials (such as metals, plastics or resins) being poured 
into a mold, allowed to solidify and then extracted for 
use. Casting can be thought of as a method for reproducing 
something - whether a mere part or a single unit by itself.

Casting is a process that can be used to manufacture 
complex parts which would prove too expensive or time-
consuming to produce using other methods such as cutting or 
shaping these from solid materials.
 
0
Rajashree
 
 
Answer
The object will be convert into another object type through 
casting. This is known as cating
 
0
Dsr
 
 
Answer
Casting means converting values from one data type  to  
other data type.For example to convert the  int values to 
float type vlaues.

Types of casting:
   1. Downcasting -source is larger than destination type
   2. upcasting   - Source is smaller than destination type.

casting can be applicable to both primitive type and Object 
type.

primitive type - convert numeral to floating point and vice 
versa.
Object type - converting from subclass to super class or 
vice versa.
             superClassObj = subClassObj;
 
0
Vijayakumar Chinnasamy
 
 
Question
What is data abstraction? Elaborate with example?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC , TCS
I also faced this Question!!   © ALL Interview .com
Answer
we noted that a procedure used as an element in creating a 
more complex procedure could be regarded not only as a 
collection of particular operations but also as a 
procedural abstraction. That is, the details of how the 
procedure was implemented could be suppressed, and the 
particular procedure itself could be replaced by any other 
procedure with the same overall behavior. In other words, 
we could make an abstraction that would separate the way 
the procedure would be used from the details of how the 
procedure would be implemented in terms of more primitive 
procedures. The analogous notion for compound data is 
called DATA ABSTRACTION. Data abstraction is a methodology 
that enables us to isolate how a compound data object is 
used from the details of how it is constructed from more 
primitive data objects.
 
5
Rajashree
 
 
Answer
hidding unneccessary data from userdetails, is called 
abstraction.
Example:TV Remote.
Buttons are cisible.circuit is not visible.(Hidden)
 
0
Dsr
 
 
Answer
we could make an abstraction that would separate the way the procedure would be used from the details of how the procedure would be implemented in terms of more primitive procedures. The analogous notion for compound data is called data abstraction. Data abstraction is a methodology that enables us to isolate how a compound data object is used from the details of how it is constructed from more primitive data objects.

The basic idea of data abstraction is to structure the programs that are to use compound data objects so that they operate on ``abstract data.'' That is, our programs should use data in such a way as to make no assumptions about the data that are not strictly necessary for performing the task at hand. At the same time, a ``concrete'' data representation is defined independent of the programs that use the data. The interface between these two parts of our system will be a set of procedures, called selectors and constructors, that implement the abstract data in terms of the concrete representation
 
0
Rahul,bit Mesra
 
 
Question
What is encapsulation? Elaborate with example?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC
I also faced this Question!!   © ALL Interview .com
Answer
Hi,
Encapsulation: The wrapping up of a data and methods into a 
single unit is called Encapsulation. You can achieve 
Encapsulation by using private data and public methods look 
at the following example for better understanding.
Eg: 
public class EcapTest{
public static void main(String args[]){
       private int a=22;
       private String s="DEVARATHNAM";
       private float f=33.24f;
       
       public void displayData(){
                 // some code
}
       public void getData(){
                 // some code
}
}//main
{//class.

Observe the above program we are combining both data and 
methods into a single unit(EcapTest). I hope i met your 
needs.
 
0
Devarathnam.c,kotagudibanda,ka
 
 
Question
What is OOP?
Rank Answer Posted By  
 Question Submitted By :: Varsha
This Interview Question Asked @   BMC
I also faced this Question!!   © ALL Interview .com
Answer
A type of programming in which programmers define not only 
the data type of a data structure, but also the types of 
operations (functions) that can be applied to the data 
structure. In this way, the data structure becomes an 
object that includes both data and functions. In addition, 
programmers can create relationships between one object and 
another. For example, objects can inherit characteristics 
from other objects.
 
0
Rajashree
 
 
Answer
OOP is an OBJECT ORIENTED PROGRAMMING LANGUAGE where 
everything is treated as Objects in ur problem space
 
0
Ershad Md Sk
 
 
Question
which methods consisting of the serilizable interface?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
There are no methods in the serializable interface.it is a 
marker interface.
 
0
Balu
 
 
Answer
actually there are two methods on serializable interface.one
is readObject and writeObject.If u implement that two method
then it behave as a normal interface.if not then it is
marker interface.
 
0
Abhi
 
 
Answer
no methods at all marker interface it is
 
0
Guest
 
 
Question
Does a class inherit the constructor of its super class?if 
it does, how can you hide that constructor? if it doesnot 
how can you call it from the sub class?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
Hi ,
 constructor is never been inherited from superclass to 
subclass.
we can call the Super class constructor in Sub class
by using 
Super();
that too this stement should be first line in method.

Best Regards.
 
0
Pandu
 
 
 
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