Search Results

Search found 1 results on 1 pages for 'jcolnz'.

Page 1/1 | 1 

  • Assigning parameter as array length

    - by Jcolnz
    I am currently stuck with a homework assignment, question below; Define a default constructor for Deck that initialises the deck field with an array of size 0. Also define a constructor that takes an integer parameter and initialises the deck field with an array of that size. The constructor should also initialise every element with a new random MovieCard. The cards should be uniquely named. so far my code is public class Deck { MovieCard[] deck = new MovieCard[] {}; public Deck() { MovieCard deck[]; } public Deck(int size) { MovieCard deck = new MovieCard[]; } } Obviously this is incomplete by I can't find any references in my previous notes about referring a parameter into an array and setting this as the length.

    Read the article

1