Помогите пожалуйста разобраться
ЧТО НЕ ТАК? НЕ МОГУ ПОНЯТЬ
в IDEA не проверяет.
На сайте выдаёт ошибку: com/javarush/task/task03/task0315/Solution.java:18: error: cannot find symbol
red.name = "Red";
^
symbol: variable name
location: variable red of type com.javarush.task.task03.task0315.Solution.Red
package com.javarush.task.task03.task0315;
/*
Каждый охотник желает знать…
*/
public class Solution {
public static void main(String[] args) {
Red red = new Red();
red.name = "Red";
Orange orange = new Orange();
orange.name = "Orange";
Yellow yellow = new Yellow();
yellow.name = "Yellow";
Green green = new Green();
green.name = "Green";
Blue blue = new Blue();
blue.name = "Blue";
Indigo indigo = new Indigo();
indigo.name = "Indigo";
Violet violet = new Violet();
violet.name = "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");
}
}
}
package com.javarush.task.task03.task0315;
/*
Каждый охотник желает знать…
*/
public class Solution {
public static void main(String[] args) {
Red red = new Red();
red.name = "Red";
Orange orange = new Orange();
orange.name = "Orange";
Yellow yellow = new Yellow();
yellow.name = "Yellow";
Green green = new Green();
green.name = "Green";
Blue blue = new Blue();
blue.name = "Blue";
Indigo indigo = new Indigo();
indigo.name = "Indigo";
Violet violet = new Violet();
violet.name = "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");
}
}
}