java - Creating ArrayList from class -


I am creating simple card games, the player has 3 cards. I have this cardpart class and I I want to create an array list

  public list & lt; CardParts & gt; Parts = new ArrayList & lt; CardParts & gt; (); Parts.add (new cardpresets ()); // & lt; == Error is here, I do not know how to create this array   

my cardpeak class:

  public class cardparts {public cardparts (String [] picz) {}} I need to use the array, so I can easily use it for loop and enter random number for each increment. For example:  parts [i] = randomnumber;   

If you are confused, then just for the plan, I need 3 cards, 11 cards in every card (array) card1 = (1, 2,3 , 4,5,6,7,8,9,0, A) , so on other cards & lt; - As such ..

Please help me solve it if you can, then this array is from the list .. However, if it is stuck, then I am ready to use another method.

thanks

When you define a rational constructor Trying to use the default No-Arif constructor of the object if you define a constructor While, the compiler no longer generates any Aarjijh constructor for you (but you can still right-Arjis constructor defined here).

Either you need to define a no-fault constructor, your CardParts class, or you pass from a string [] to the manufacturer So that they match the CardParts (string []). .

You probably want to read.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -