can we add primitive data to wrapper class object

Ads
 

can we add primitive data to wrapper class object

Hi, Here is my code: class Myclass{ public static void main(String args[]){ int i=2; Integer a= new Integer(3); a=a+i; System.out.println("a"+a); } }

Thanks

View Answers

November 10, 2010 at 3:10 PM

Hello Friend,

Yes, you can.

Thanks

Ads









Related Tutorials/Questions & Answers:
Wrapper Class in Java
Wrapper Classes provide object methods for the eight primitive data types... package that defines the eight primitive data types in Java. We need Wrapper... that holds the value 10. Whereas, object of a Wrapper Integer class can be created
Wrapper Class
Wrapper Class  what is wrapper class in java and why we use it   Hi Friend, Wrapper class is a wrapper around a primitive data type. It represents primitive data types in their corresponding class instances e.g.
Advertisements
can we use scanner class,class , object and methods to get output without using constructor ????
can we use scanner class,class , object and methods to get output without using constructor ????  im getting error here..i hav used scanner class... am i getting error here... can we get output using scanner class , object
Wrapper
provides wrapper classes corresponding to each primitive data types in its "... and corresponding wrapper class: Primitive type Wrapper class byte... utility methods to manipulate the values. All of the primitive wrapper classes
Can you create an object of an abstract class?
Can you create an object of an abstract class?   Hi, Can you create an object of an abstract class? Thanks
struts2 how can we add an radio button to form using a class(doa)
struts2 how can we add an radio button to form using a class(doa)  Hi I had created an class of subscription,and iam trying to add an radio... class: import java.util.*; /** * State generated by hbm2java */ public
struts2 how can we add an radio button to form using a class(doa)
struts2 how can we add an radio button to form using a class(doa)  Hi I had created an class of subscription,and iam trying to add an radio... class: import java.util.*; /** * State generated by hbm2java */ public
Java Wrapper Class Example
respective wrapper class : Primitive Data Type Wrapper Class boolean...Java Wrapper Class Example In this section we will read about how to use the wrapper classes in Java. Wrapper classes wrap the primitive data types
wrapper class.
wrapper class.  Write short note on character wrapper class.   Java Character Wrapper class The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field
Primitive Data Types
In this section we will discuss about Primitive Data Types in Java 7
Can we instantiate abstract class in Java?
Can we instantiate abstract class in Java?  HI, Can we instantiate abstract class in Java? Thanks   Hi, No, you can't instantiate an abstract class. Thanks
java-wrapper class
java-wrapper class  dear people, may i know how to convert primitive data type into corresponding object using wrapper class with example please!!!   public class IntToIntegerExample { public static void
wrapper class
wrapper class  list wrapper class methods
wrapper class
wrapper class  wrapper class methods
size of all primitive data
size of all primitive data   java program for to find the size of all primitive data types in java
Examples of Wrapper Class
Examples of Wrapper Class In this page we are giving you the links...;  1.  Adding value through add(int, Object) method. 2.  Adding value through add(Object) method. 3.  Append all elements through
How many cookie object we can store in a session? is there any limit?
How many cookie object we can store in a session? is there any limit?  How many cookie object we can store in a session? is there any limit
Java Integer class
; Java provides wrapper classes corresponding to each primitive data types... wrapper object can be helpful in situations where only objects can be utilized... wraps a value of type int in an object. It's constructor can take int value
Autoboxing in Java
types into Wrapper class by Java compiler takes place when: a primitive data... of corresponding wrapper class a primitive data type is assigned to a variable of the corresponding wrapper class. Primitive data type Wrapper class
wrapper class
wrapper class  why wrapper class does not have a default constructor
Are arrays primitive data types?
Are arrays primitive data types?   Hi, Are arrays primitive data types? thanks   Hi, In Java, Arrays are objects. Identifier are some... as primitive data type
How can we save a data list in jsf?
How can we save a data list in jsf?  I have a code in jsf that fires a query in Data Base each time it is called, i have added a validation check to fire query only if list is not-empty but the list gets empty each time
can we use class in jsp which implements interface
can we use class in jsp which implements interface   can we use class in jsp which implements interface
wrapper classes
;Java Wrapper Class Wrapper class is a wrapper around a primitive data type. It represents primitive data types in their corresponding class instances e.g. a boolean data type can be represented as a Boolean class instance. All
5 Crazy Ways Big Data can Add Value to Life
by analyzing this real-time sensor data prescribe the routes that can save time and fuel... with Big Data analytics? Well, some latest developments can really allow us... hundred million. Do you have any clue how Big Data can help preventing this? Well
Limit the Class Object Creation
Limit the Class Object Creation In this section you will learn about how a class object creation can be a restricted to a fix number of times... to restrict the object creation of a class. This is a simple code in Java where I have
Object class in java
Object class in java  want an example and with an explaination about equals() method in object class? Is equals() is similar
wrapper class concept
wrapper class concept  Write a Java class that stores an integer item id, a string item name and a float price. Store all these in a String member Variable, separated by a space delimiter. Use an overloaded method to add
Wrapper Class Tutorial and Examples
Wrapper Class Tutorial and Examples   ... an element with the add(int, Object) method In this section you will learn to insert an element at the specified position using the add(int, Object) method
Does memory for Class or Object?
Does memory for Class or Object?   Does memory for class(methods & instance variables)allocated without it's object creation?If no,then The main() itself has associated with a class for which there is no instance creation,how
Using HeaderFooter class of iText API , Can we display multiple phrases in the footer section of PDF ,each with different alignment.
Using HeaderFooter class of iText API , Can we display multiple phrases... on the right and Third phrase in the middle. How can we acheive this? is it possible... a similar question related to HeaderFooter class, I want to display three Phrases

Ads