| Back to Questions Page |
| Question |
If a multi threaded Java program has started numerous number
of threads, at any point in time how to know which thread is
currently executing/running ? |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Akj504 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
Using Java Debugger "jdb" one gets information about
which thread currently executing threads  |
0 | Chellammal |
| |
| |
| Answer |
but if I want check/findout within my program itself
How do I do that ?  |
0 | Akj504 [IT] |
| |
| |
| Answer |
You can check by putting following code in your program
Thread t = Thread.currentThread();
System.out.println("Current Thread: "+t);
 |
0 | Namita Kapoor [IT] |
| |
| |
|
|
| |
| Answer |
Check executing/running current thread by
currentThread() [Method]
public static Thread currentThread()
Find the currently executing thread.
Returns:
the currently executing thread  |
0 | Adminraj [IT] |
| |
| |
| Answer |
by using currentThread() Method ,we can find which thread
is runing  |
0 | Srinivas [IT] |
| |
| |
| Answer |
We can check the current Thread name as
Thread t= new Thread.currentThread();
System.out.println(t.getName());  |
5 | Ankush Sharma [IT] |
| |
| |
| Question |
Difference between overloading and Overriding. <Giving a
confusing example to test the concept.>
(also asked in PA Consultancy Group,iflex,Value
chain,IBM,CTS,Accenture, Tarang> |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Esha Prasad |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
Over loading is polymorphism implementation in same class,
where two or more methods can share same name differing in
parameters passed.
Overriding is polymorphism implementation in different
classes having parent child relationship and the
funtionality in parent class is over shadowed by the
funtionality in subclass.  |
4 | Esha Prasad |
| |
| |
| Answer |
Overloading class has different returntype.
overloading comes with in class but overriding comes in two
classes.
Overloading is resolved at compiletime
Overriding is resolved at runtime.  |
0 | Rakesh |
| |
| |
| Answer |
overloading means same method name but different parameters
are passed but overriding means same method name with same
parameters passed in different classes.  |
5 | Arthi |
| |
| |
| Answer |
overloading : can only be done by changing the type or no.
of parameters for eg:a(int a);
a(int a,int b);
while in case of overriding we can give new definition
without changing the parameters.  |
0 | Varun |
| |
| |
| Question |
What do u mean by wrapper Class?
What do u mean by Jvm... How do u change JVM for other OS?
Or No need to Change ...? its like tricky |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
In general in java language everything is object but
Primitive data types are not objects.We need a conversion
from primitive data type to object .For this conversion
java provides Wrapper classes.
datatype Wrapper class
int-------Integer
float-----Float
double----Double
long------Long
short-----Short
byte------Byte
char------Char  |
2 | Babu |
| |
| |
| Answer |
wraper classes that allow primitive types to be accessed
as objects.
These classes are similar to primitive data types but
starting with capital letter.
Number Byte Boolean
Double Short Character
Float Integer  |
0 | Penchala |
| |
| |
| Answer |
The Wrapper class represents the base class for a set of
data sources. This class provides library initialization
services and access to the data source servers that the
wrapper supports. The Wrapper class maintains the following
information:
The wrapper name.
The wrapper core library name. The returned name is the
name of the native library that loaded the wrapper.
A WrapperInfo object that contains all of the information
that pertains to this wrapper. This information gets stored
in the federated server's system catalog as a result of
issuing the DDL statements CREATE WRAPPER or ALTER WRAPPER.
The Wrapper class is a wrapper class for the Java API.
JVM (Java Virtual Machine): A Java runtime environment,
required for the running of Java programs, which includes a
Java interpreter. A different JVM is required for each
unique operating system (Linux, OS/2, Windows 98, etc.),
but any JVM can run the same version of a Java program.  |
0 | Rajashree |
| |
| |
| Answer |
wrapper class is the one which will allow the primitive
datatypes to be used as objects.
Jvm is the java virtual machine which will convert the byte
code to user understandable code.
 |
0 | Ravikiran |
| |
| |
| Answer |
"Wrapper class" has two meanings.
A class with a similar name to a primitive type, which
encapsulates the value of that primitive, and provides
methods which relate to that sort of primitive.
A class which calls methods of something else, and adds an
additional layer of functionality.
The first sort includes Integer, Double, etc, and there are
(I think) also classes like Void. Also an interface called
NullType.
In the 2nd sort you could have a List and surround it with
a class which calls all the List methods, but makes sure
that all the calls become thread-safe. Look in the
Collections class for methods like synchronizedList.  |
0 | Rajesh |
| |
| |
|
| |
|
Back to Questions Page |