Solved

Parsing array

Posted on 2004-04-13
6
198 Views
Last Modified: 2012-05-04
I want to parse two arrays to a constructor of a class. why aint it working?

int bPos[] = new int[2];
int pPos[] = new int[2];
GameTreeNode root = new GameTreeNode(pPos[0], pPos[0]);

with:

public GameTreeNode (int[] playerPos, int[] ballPos)
        {
                  }
0
Comment
Question by:jtcy
  • 3
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
Nick_72 earned 105 total points
ID: 10812434
You're sending just one element from the arrays as parameters, should be:

GameTreeNode root = new GameTreeNode(pPos, pPos);

/Nick

0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 20 total points
ID: 10812442
Also, the arrays are still empty so it won't work anyway
0
 
LVL 9

Assisted Solution

by:Nick_72
Nick_72 earned 105 total points
ID: 10812444
and I guess one of them should be bPos... :)

GameTreeNode root = new GameTreeNode(pPos, bPos);
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 86

Expert Comment

by:CEHJ
ID: 10812445
(probably)
0
 

Author Comment

by:jtcy
ID: 10812457
thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10812472
8-)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question