R
R
roman38472014-06-09 19:20:19
Java
roman3847, 2014-06-09 19:20:19

Is it possible in Java to create an array without a type definition?

For example, one array that can hold both String and Int?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FoxInSox, 2014-06-09
@roman3847

You can:
Just do not forget about autoboxing. If you put an int in the array, then an Integer object will be created:

a[0] = 10;
a[0] = new Integer(10); //тоже самое

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question