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
 
  J2ME (99)  Java-Related-AllOther (21)
 


 

Back to Questions Page
 
Question
What are synchronized methods and synchronized statements?
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   Adobe
I also faced this Question!!   © ALL Interview .com
Answer
Syncronized methods are executed only after a lock is 
acheived on the classes or objects specified in the methids 
and after that the methids are executed

Synchronized methods are executed after lock is acieved on 
class or object specified in the synchronized statement
 
0
Sainaveen
 
 
Question
In howmany ways a thread can be created?
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   HCL
I also faced this Question!!   © ALL Interview .com
Answer
1. Extending the Thread class
2. Implementing Runnable interface in a class and then
passing its reference to a new Thread.
3. Creating an anonymous class to extend the Thread class.
4. Creating an anonymous class to implement the Runnable
interface and then passing its reference to a new Thread.
 
0
Ranganathkini
 
 
Answer
There are two different ways to create a Thread.  One is 
extends Thread class and implement Runnable Interface.  
Better to go for Runnable interface.  It will have a method 
run().  You should override in the sub class.  Even, you 
can extend another class to the same thread class.
 
0
Harish
 
 
 
Question
For an example, if we have some variable in run method, and 
we created one or more threads. Does all threads will share 
the same variable or a copy of variable is created for each 
thread??
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
No, each thread will have its own copy of the variable.

The reason is that run() is a method and any variable
declared inside a method is considered a local method and
its scope remains only within that method. If new thread
instances are spawned then each thread instances' run()
method will have their own copy of the variable.
 
0
Ranganathkini
 
 
Question
What is the use of Semaphore?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
Semaphore variable are to make sure that some shared 
variable is not being modified/updated simultaneously by 
two separate processes/threads.
 
0
Geeta
 
 
Answer
It is being used to prevent DEADLOCK upto some extent only.
It is a primitive level mechanism.
 
0
Anonymous
 
 
Answer
Semaphore is to solve the problem of syncronisation. It is 
a monitor, to monitor the critical section of the program.

it can be implemented with the help of the a single 
variable and depending upon the value of that variable 
thread is allowed to enter in the critical section.
 
0
Rajesh
 
 
Question
JMS based on what technology?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
JMS is based on Java technology it used for messaging 
between different applications.JMS provides asynchronous 
messaging.
 
0
Sainaveen
 
 
Question
Is 'synchronised' a modifier?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
no synchronised is not a modifier

it is a key word which can do a specific functionality on 
thread.
 
0
Satya
 
 
 
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