Getting the required output as follows,
Red
Orange
Yellow
Green
Blue
Indigo
Violet
Then why codegym is saying the order is not correct. Codegym please help!
package com.codegym.task.task03.task0315;
/*
Roy G. Biv…
*/
public class Solution {
public static void main(String[] args) {
Solution.Red red = new Solution.Red();
Solution.Orange orange = new Solution.Orange();
Solution.Yellow yellow = new Solution.Yellow();
Solution.Green green = new Solution.Green();
Solution.Blue blue = new Solution.Blue();
Solution.Indigo indigo = new Solution.Indigo();
Solution.Violet violet = new Solution.Violet();
}
public static class Red {
public Red() {
System.out.println("Red");
}
}
public static class Orange {
public Orange() {
System.out.println("Orange");
}
}
public static class Yellow {
public Yellow() {
System.out.println("Yellow");
}
}
public static class Green {
public Green() {
System.out.println("Green");
}
}
public static class Blue {
public Blue() {
System.out.println("Blue");
}
}
public static class Indigo {
public Indigo() {
System.out.println("Indigo");
}
}
public static class Violet {
public Violet() {
System.out.println("Violet");
}
}
}
Solution.Red red = newSolution.Red();