array accept all data type

Ads
 

array accept all data type

how can create array that accept all data type??? if we can solution it? how..

View Answers

January 22, 2011 at 10:49 AM

Hi Friend,

Try the following code:

import java.lang.reflect.*;
class  CreateArrayOfAllTypes{
    public static void main(String[] args) 
    {
        Object[] arr = (Object[]) Array.newInstance(Object.class, 4);

        Array.set(arr, 0, 1);
        Array.set(arr,1,"A");
        Array.set(arr,2,'B');
        Array.set(arr,3,5.5);

         for (int i = 0; i <arr.length; i++) {
         System.out.println(Array.get(arr, i));
    }
    }
}

Thanks


January 23, 2011 at 12:25 AM

thank u ...so much my friend...thinks thinks thinks thinks.. but if you can using this array in queue how ?? and output like this:(by using switch case) ask user : 1-create array//accept all data type 2-enQueue 3-dQueue 4-search 5-To Exit...

Ads









Related Tutorials/Questions & Answers:
array accept all data type
array accept all data type  how can create array that accept all data type??? if we can solution it? how..   Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public
array accept all data type
array accept all data type  how can create array that accept all data type??? if we can solution it? how..   Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public
Advertisements
bitwise operators accept type char as operands
bitwise operators accept type char as operands   Why bitwise operators accept type char as operands
data type
data type  which data type is used to store video file in mysql databse
data type
data type  what are the date types in the java and vb.net? what is the difference between java and vb.net?   Hi Friend, java data types... vb.net data types are: Byte SByte Short UShort Integer UInteger Long ULong
JSP Array
JSP Array          Array is defined as the set of similar type of data in series. The Array can be String, int or character kind of datatypes
the array list contains similar type of elements or disimilar type of elements
the array list contains similar type of elements or disimilar type of elements  the array list contains similar type of elements or disimilar type of elements
Array example
Array example       Array is an object that hold the data of similar type. The length of an array is decided when an array is created. Length in array cannot
Data type in java
in large array. Default value is 0. int : int data type is 32-bit signed two's.... Class, array and interfaces are reference data type. Default value of any...Data type in java In this section we will tell you about data type in java
grouping similar data of array
grouping similar data of array   I have sorted array of integer . how can I define new arrays with similar data . indeed I want to grouping similar data of array . example: input : int num[] = {20,21,21,24,26,26,26,30}; output
Array list in Java - arraylist type error
Array list in Java - arraylist type error  I am using Array list in Java but when i compile i get array list type error. Can anyone please explain what is array list type error and why it occurs
Enum data type
Enum data type  How can we use enum data type in java program?  ... data type. Here we have defined Fruits as enum type by using the enum keyword. Now... data type. Here we have defined Fruits as enum type by using the enum keyword. Now
Data Conversion from int to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from int primitive type to another data type like String, boolean and char etc
Data Conversion from String to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from String primitive type to another data type like int, boolean and char etc
Data Conversion from short to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from short primitive type to another data type like String, boolean and char etc
Data Conversion from byte to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from byte primitive type to another data type like String, boolean and char etc
Data Conversion from float to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from float primitive type to another data type like String, boolean and char etc
Data Conversion from double to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from double primitive type to another data type like String, boolean and char etc
Data Conversion from long to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from long primitive type to another data type like String, boolean and char etc
how insert data from databse in array and compare new data to already stored value in array
how insert data from databse in array and compare new data to already stored value in array   hello all i tried to fetch data from databse and try to stored it in an array and i want to compare new value that come from database
MySQL Boolean Data Type
MySQL Boolean Data Type This example illustrates how create a boolean data type. In this example we create a table 't' where define four field that is 'a' which is BOOL type, 'b' which is FLOAT type, 'c' which is LONG VARCHAR type
Java Array Length
Java Array Length In this section you will find a program to find the length of array in java. An array is collection of similar data type. To find the length of array is a simple program in java. Using length function you can find
Two dimensional array in java
of similar data type or it can hold fixed number of value of same type. Two... of array can be of any type object. When we create array then length will be established, it is fixed when created.In two dimension array data
Modify Data Type with ALTER Command
Modify Data Type with ALTER Command  Is it possible to modify the Data type of a column which has at least one data in it?If it is possible,then what will happen to the data in the column? Example. Table Name: Emp EmpName
C Array length example
of an array in C. An array is a contiguous group of data items with the same name and data type. In order to get the length of an array, we have used the sizeof operator... C Array length example     
array find all possible dimension
array find all possible dimension  Given array: int[] dimension = { 1, 2, 3 }; That produces the output: 1 2 3 12 13 23 123 I'm new to array...i can't figure out the way on even how to start... any idea?...really appreaciate
size of all primitive data
size of all primitive data   java program for to find the size of all primitive data types in java
Mysql Alter Data Type
Mysql Alter Data Type       Mysql  Alter Date Type is used to modify or change the Column... Alter Date Type'.To understand this example we create a table 'userform
C Array Declaration
. To declare an array in C, you have to specify the name of the data type and the number of elements inside the square brackets. Syntax for creating an array   data... type. The values inside this array arr or any array can be accessed
ModuleNotFoundError: No module named 'algebraic-data-type'
ModuleNotFoundError: No module named 'algebraic-data-type'  Hi, My... named 'algebraic-data-type' How to remove the ModuleNotFoundError: No module named 'algebraic-data-type' error? Thanks   Hi
ModuleNotFoundError: No module named 'data_type_tools'
ModuleNotFoundError: No module named 'data_type_tools'  Hi, My... named 'data_type_tools' How to remove the ModuleNotFoundError: No module named 'data_type_tools' error? Thanks   Hi, In your python

Ads