why the primitive data type have classes?

Answer Posted / manikandan [ gtec,vellore ]

there are different type of data types such as int,char
etc.for example suppose if we using arrays it can store a
similar data types but we need to store a char and int in a
same array what can we do for this situation. the wrapper
class helps in this situation by storing a objects in to a
arrays.

example

ArrayList v=new ArrayList();
v.add(new Integer(1));
v.add(new Character('a'));//

the int and char are different type but we stores it by an
object.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What about abstract classes in java?

612


What is meant by call by reference?

511


Which package is imported by default?

637


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

655


What are the disadvantages of using inner classes?

556






What does opcode mean?

539


Is there a way to increase the size of an array after its declaration?

601


Which is better 64 bit or 32 bit?

507


Can a static class have a constructor java?

550


What is finalize() function in java?

563


Difference between notify() method and notifyall() method in java?

550


What is the difference between inheritance and encapsulation?

595


Why do we need data structure in java?

574


What is the difference between overriding & overloading?

566


Why we do exception handling in java and how many types of exceptions are there?

547