package javaapplication54;
public class JavaApplication54 {
static int monkey = 8;
static int theArray[] = new int[1];
public static void main(String[] args) {
// i attempted two ways to try to set monkey to = theArray[0];
monkey = theArray[0];
theArray[0] = monkey;
//i tried to get the result 8;
System.out.println(theArray[0]);
}
我想要得到的结果8,通过打印出theArray [0],但结果是零。
run:
0
BUILD SUCCESSFUL (total time: 0 seconds)
不要尝试两种不同的方式在同一时间! 'theArray [0] =猴子;'是正确的。 –