vijay


{ City } bangalore
< Country > india
* Profession * se
User No # 3151
Total Questions Posted # 0
Total Answers Posted # 36

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 461
Users Marked my Answers as Wrong # 82
Questions / { vijay }
Questions Answers Category Views Company eMail




Answers / { vijay }

Question { 5597 }

What is casting?


Answer

Casting mostly used for converting value from one data type
to another data type.Mostly used for convert incompatible
data.

eg:

WRRONG
long a=20; // a is 64bit(long) data
int b=10; // b is 32 bit data.
b=a; // u r trying to assign 64bit data into 32 bit data

CORRECT
long a=20; // a is 64bit(long) data
int b=10; // b is 32 bit data.
b=(int)a; // ur converting 64bit data into 32bit data
then assign to variable b.

Is This Answer Correct ?    5 Yes 0 No

Question { 7607 }

How are Java source code files named?


Answer

If a java source code file contain public class then the
source code file name should be public class name other
wise compiler error.


if a java source code does not contain the public class
then the name may be class name or anything ,not a problem.

Is This Answer Correct ?    1 Yes 0 No


Question { 7534 }

Does 'true' and 'false' are keywords?


Answer

true and false are literal constant in java.there is no
numeric value for true and false like 1 and 0 or char value
T and F.

Is This Answer Correct ?    4 Yes 0 No

Question { 21605 }

Can you extend more than one interface?


Answer

There is no limit for interface extends. One interface can
extends any number of interfaces.

interface inter1 { }

interface inter2 { }

interface interN { }

interface ExtendsInterface extends inter1,inter2,... , interN {

}

Is This Answer Correct ?    31 Yes 4 No

Question { IBM, 53079 }

Difference between String & StringBuffer


Answer

String :
1.Content does not change –immutable

2.final class (cant subclass)

3.compareTo() - compare the string
result : < , > , = --- dictionary order

4.reverse() not available

5.is not thread safe

Criteria to choose among String
If your text is not going to change use a string Class
because a String object is immutable.



StringBuffer:

1. Content can be change Mutable

2.Final class.

3. compareTo() Not available


4.reverse() available

Allocates room for 16-addition character space when no
specific length is specified.

5.is thread safe

Criteria to choose StringBuffer

If your text can changes, and will be accessed from
multiple threads, use a StringBuffer because StringBuffer is
synchronous

Is This Answer Correct ?    52 Yes 9 No

Question { 15491 }

Can you declare a static variable in a method?


Answer

No static variable cannot be declared within static/non-
static method.

only "final" and "default" allowed within in method for
variable declaration. i.e u cant use
private,protected,public,static within method .it display
the compile time error "Illegal modifier".

Is This Answer Correct ?    11 Yes 1 No

Question { 6030 }

How to find the length and capacity of a string buffer ?


Answer

StringBuffer conatain a method called length() to find out
the length and capacity() to findout the capacity of
stringbuffer.

ex:
StringBuffer buffer=null;
buffer.length();
buffer.capacity();

Is This Answer Correct ?    6 Yes 0 No

Question { RoboCom, 12614 }

Different types of modifiers?


Answer

Modifiers are
final,static,volatile,abstract,synchronization,native ,
strictfp

Is This Answer Correct ?    11 Yes 9 No

Question { 5333 }

What are packages and name a few?


Answer

Collection of class and interfaces stored under specific
name is called as packages.

eg: ArrayList,Vector,HashTable are class available in the
packahe java.util.

some of the packages are,
java.lang, java.io,
java.util,javax.servlet.http.HttpServlet.. etc.

Is This Answer Correct ?    0 Yes 0 No

Question { 5841 }

primitive data types in Java ?


Answer

Primitive data type:
====================
1 Numeric: type
a. whole numbers: byte,short,int,long
b.float numberis: float,double

2.character type
char

3.Boolean type
boolean

Abstract data type (ADT):
========================
String

Is This Answer Correct ?    6 Yes 0 No

Question { Greenwood, 30393 }

What are the limitations for static method?


Answer

Static Method:
a. Access only static type data (static type instance
variable).
b. Call only static method ,if non-static then compile
time error.
c.No need the class object to call the static method.
d.Cant use this and super keyword otherwise compile time
error.

Is This Answer Correct ?    50 Yes 4 No

Question { Noah Solutions, 21510 }

What are wrapper classes?


Answer

Wrapper class : A class to enclosed(wrapped) the primitive
data type.

eg: Integer - it wrapp the int primitive data type.
Character - it wrap the chat data type.

int a=10;
Integer i=new Integer(a);

Java Wrapper class:

Integer,Byte,Short,Character,Boolean,Long,Float,Double.

Is This Answer Correct ?    13 Yes 5 No

Question { CTS, 11310 }

What is Remote Interface ?


Answer

If the client is outside of ejb conatainer then use the
remote interface to specify the business methods.

Is This Answer Correct ?    9 Yes 0 No

Question { 7817 }

What is meant by serialisation and deserialisation?


Answer

Serialization : means storing the object into persistenece
storage like seconday memory ,files.

Deserialization : means restoring the persistent object.

Is This Answer Correct ?    2 Yes 1 No

Question { 4348 }

What is the Set interface?


Answer

Set is an interface in java.util package.Set does not allow
duplicate values but using set we can easily sort the
elements in ascending order using treeset.

Is This Answer Correct ?    1 Yes 0 No

 [1]   2   3    Next