About 139,000 results
Open links in new tab
  1. Creating an array of objects in Java - Stack Overflow

    Initialization – The array is always initialized to the data type’s default value. But we can make our own initializations. Declaring Arrays In Java. This is how we declare a one-dimensional array …

  2. How do I declare and initialize an array in Java? - Stack Overflow

    Jul 29, 2009 · You can either use array declaration or array literal (but only when you declare and affect the variable right away, array literals cannot be used for re-assigning an array). For …

  3. How to initialize an array of objects in Java - Stack Overflow

    I want to initialize an array of Player objects for a BlackJack game. I've read a lot about various ways to initialize primitive objects like an array of ints or an array of strings but I cannot take …

  4. How to create an Array of Objects in Java - Stack Overflow

    May 6, 2013 · When you initialize an array, all elements take on the default value. So, when you initialize an int[] , all elements are 0, so no problem using that or assigning a new value to it. …

  5. Creating array of custom objects in java - Stack Overflow

    Dec 5, 2013 · Is there any way to create all the 100 objects outside the array and just assign data inside the for loop. I already tried Array.newInstance and SomeClass[] s1 = new …

  6. java - Creating an Arraylist of Objects - Stack Overflow

    Oct 20, 2010 · If you want to allow a user to add a bunch of new MyObjects to the list, you can do it with a for loop: Let's say I'm creating an ArrayList of Rectangle objects, and each Rectangle …

  7. Creating Array Objects in Java? - Stack Overflow

    Oct 17, 2014 · When you assign an "exam" to the array, it doesn't create a new object. It merely stores the reference of an existing object in the array. If I understand your second question, …

  8. creating multiple objects in java oop - Stack Overflow

    Feb 17, 2013 · however, if you want a dynamic array, use a List implementing class like ArrayList which doesn't require you to provide size while creating the array. List<User> usersList = new …

  9. Creating an instance of an array of objects class in Java

    Apr 21, 2014 · @Acoustic77 - The variable myDeck is not an array, so you can't access parts of it using array subscripting. If you want to print the i-th card in the deck, you'll need a getter …

  10. creating array of objects from abstract and subclasses java

    Nov 11, 2011 · I read in each line, and split it at the "," and read this into a temp array. I then create my empty array to read into it the properties from my superclass and with the …

Refresh