Meaningless Drivel is fun!
The moose likes Java in General and the fly likes Integer array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Integer array" Watch "Integer array" New topic

Integer array

Misbha Ali

Joined: Jul 22, 2003
Posts: 7
Please let me know how to form an Integer array.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

"How to form an Integer array." Hmmm. Well, using "new", the way you create all other kinds of arrays, or using direct initialization. A few examples:

Now, given that you're asking this question, it's possible that you don't mean java.lang.Integer objects at all, but arrays of int primitives. So I'll show those too:


[Jess in Action][AskingGoodQuestions]
Gary Mann
Ranch Hand

Joined: Jun 05, 2003
Posts: 37
Integer[] integerArray = new Integer[10]; // define
// populate
for (int i = 0; i < integerArray.length; ++i) {
integerArray[i] = new Integer(i * 10);
I agree. Here's the link:
subject: Integer array
It's not a secret anymore!