Please Help identify the Output !

Given the following,

1. public class CommandArgsThree {

2. public static void main(String [] args) {

3. String [][] argCopy = new String[2][2];

4. int x;

5. argCopy[0] = args;

6. x = argCopy[0].length;

7. for (int y = 0; y < x; y++) {

8. System.out.print(" " + argCopy[0][y]);

9. }

10. }

11. }

and the command-line invocation,

java CommandArgsThree 1 2 3

what is the result?

Could you also clearly explain the reason for a particular output ? Thanks in advance !

Message was edited by:

aron_phil

[608 byte] By [aron_phila] at [2007-11-27 11:52:30]
# 1

request to do homework where you show no indication of having done your own work: DENIED!

petes1234a at 2007-7-29 18:44:51 > top of Java-index,Java Essentials,New To Java...
# 2

wats that ? i just needed a reason for a particular output !

aron_phila at 2007-7-29 18:44:51 > top of Java-index,Java Essentials,New To Java...
# 3

> wats that ? i just needed a reason for a particular

> output !

your code:

public class sample1 {

public static void main(String [] args) {

String [][] argCopy = new String[2][2];

int x;

argCopy[0] = args;

x = argCopy[0].length;

for (int y = 0; y < x; y++) {

System.out.println(" " + argCopy[0][y]);

}

}

}

output:

// no output

Yannixa at 2007-7-29 18:44:51 > top of Java-index,Java Essentials,New To Java...
# 4

In that case figure it out for yourself. As a last resort you could type the code up, compile it and run it for yourself. Why shoould we do it for you? Are you that lazy?

floundera at 2007-7-29 18:44:51 > top of Java-index,Java Essentials,New To Java...