Manipulating Arrays

Advertisement
October 11

Hi I am having trouble with 2D arrays.
public class cross{
public cross() {
A = new String[3][];
A[0] = new String[3];
A[1] = new String[3];
A[2] = new String[3];
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
A[i][j] = "Empty";
Is there anyway i can define a method which makes it possible for me to change the values of a specific element?

Advertisement

Replay

Hi I am having trouble with 2D arrays.
public class cross{
public cross() {
A = new String[3][];
A[0] = new String[3];
A[1] = new String[3];
A[2] = new String[3];
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
A[i][j] = "Empty";
}What I am trying to say is that how do i come up with a method, for e.g. changeCross(int x, int y), where x and y will go into A[x][y] and thus I am able to change the value for that particular element. Remember cross is not an array object. Is my concept of array and classes wrong?

View 4 Replies

Tags:

  1. ipad a1396 charging only vibrate no on
  2. ipad A 1460 is disabled itunes
  3. youtube does not open safari mac kids ç
  4. java deconfig for old jav r12
  5. sapjco3 Connect to SAP gateway failed
  6. Primary BT ID
  7. ke30 export
  8. tongueri1
  9. negativex5u
  10. vpn n8
Copyrights 2019 Fcffair BigData Resource, All rights reserved