Don't understand why I have the package name in the output when I run the code. Everything seems to be good, but the code adds the name of the package in the final line of the output. can someone please explain?
package com.codegym.task.task03.task0315;
public class Solution {
public static void main(String[] args) {
//write your code here
Red red=new Red();
Orange orange=new Orange();
Yellow yellow=new Yellow();
Green green=new Green();
Blue blue=new Blue();
Indigo indigo=new Indigo();
Violet violet=new Violet();
System.out.println(red);
System.out.println(orange);
System.out.println(yellow);
System.out.println(green);
System.out.println(blue);
System.out.println(indigo);
System.out.println(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.codegym.task.task03.task0315;
public class Solution {
public static void main(String[] args) {
//write your code here
Red red=new Red();
Orange orange=new Orange();
Yellow yellow=new Yellow();
Green green=new Green();
Blue blue=new Blue();
Indigo indigo=new Indigo();
Violet violet=new Violet();
System.out.println(red);
System.out.println(orange);
System.out.println(yellow);
System.out.println(green);
System.out.println(blue);
System.out.println(indigo);
System.out.println(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");
}
}
}