it works, but not completely.
Red a = new Red();
System.out.println(a);
all day trying to complete this task, without internet only www.w3schools.com , and couple of book of java (head first one them). This code is all that I was able to achieve for this moment.
I dont know how to get rid of (my guess is) the physical address of class Solution.
package com.codegym.task.task03.task0315;
/*
Roy G. Biv…
*/
public class Solution {
public static void main(String[] args) {
Red a = new Red();
Orange a1 = new Orange ();
Yellow a2 = new Yellow ();
Green a3 = new Green();
Blue a4 = new Blue();
Indigo a5 = new Indigo();
Violet a6 = new Violet();
System.out.println(a);
System.out.println(a1);
System.out.println(a2);
System.out.println(a3);
System.out.println(a4);
System.out.println(a5);
System.out.println(a6);
}
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");
}
}
}