Java array. What's the difference between the two examples? Help me!

Asked 2 years ago, Updated 2 years ago, 22 views

public class DefineDemo {

    public static void main(String[] args) {

        String[] classGroup = { "Choi Jin-hyuk", "Choi Yu-bin", "Han Yi-ram", "Going"};

    }

}
public class GetDemo {

    public static void main(String[] args) {
        String[] classGroup = { "Choi Jin-hyuk", "Choi Yu-bin", "Han Yi-ram", "Going"};
        System.out.println(classGroup[0]);
        System.out.println(classGroup[1]);
        System.out.println(classGroup[2]);
        System.out.println(classGroup[3]);

    }

}

java

2022-09-22 15:25

1 Answers

System.out.println(classGroup[0]);

System.out.println(classGroup[1]);

System.out.println(classGroup[2]);

System.out.println(classGroup[3]);

There's nothing else but a printout.


2022-09-22 15:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.