Searching for "Wrapper"

Q:

Metal present in chocolate wrappers is

A) Aluminium B) Haemoglobin
C) Chalk D) Chlorophyll
 
Answer & Explanation Answer: A) Aluminium

Explanation:

Metal Aluminium is present in chocolate wrappers.

metal_present_in_chocolate_wrappers1543390493.jpg image

Report Error

View Answer Report Error Discuss

Filed Under: Chemistry
Exam Prep: GATE , CAT , Bank Exams , AIEEE
Job Role: Bank PO , Bank Clerk , Analyst

Q:

The leaves used as wrappers for bides are obtained from which one of the following ?

A) Shikakai B) Rudraksha
C) Tendu D) Lemon grass
 
Answer & Explanation Answer: C) Tendu

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Biology

Q:

Why do we need wrapper classes in Java?

Answer

Dealing with primitives as objects is easier at times. Most of the objects collection store objects and not primitive types. Many utility methods are provided by wrapper classes. To get these advantages we need to use wrapper classes. As they are objects, they can be stored in any of the collection and pass this collection as parameters to the methods.


 


Features of the Java wrapper Classes:


- Wrapper classes convert numeric strings into numeric values.


- The way to store primitive data in an object.


- The valueOf() method is available in all wrapper classes except Character


- All wrapper classes have typeValue() method. This method returns the value of the object as its primitive type.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

Q:

What is a Wrapper class?

Answer

Wrapper classes wrap primitive values in a class and offers utility to access them through objects. Some of the primitive wrapper data types are:


Byte, short, int, long, float, double, char, Boolean.


Example: 


Create a class name VectorAdd to populate it with integer values using the add(int, object) method.


public class VectorAdd


{


       public static void main(String argv[])


       {


             Vector v = new Vector();


             v.add(0,new Integer(10));


             v.add(1,new Integer(20));


             v.add(2,new Integer(30));


             for(int i=0; i < v.size();i ++)


             {


                  Integer iw =(Integer) v.get(i);


                  System.out.println(iw);


             }


       }


}

Report Error

View answer Workspace Report Error Discuss

Subject: C++