Online Java Compiler By
JavaTpoint.com
import java.lang.*; enum Colour{ Red,Pink,Black,Blue,White,red; } public class Enum_cloneMethodExample1 { String Red; public static void main(String[] args) { Enum_cloneMethodExample1 enu = new Enum_cloneMethodExample1() { protected final Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } }; Colour col = Colour.Red; switch (col) { case Red: System.out.println("People with Red as their favourite colour are generally wiser."); break; case Blue: System.out.println("People with Blue as their favourite colour are ambitious in life."); break; case Black: System.out.println("People with Black as their favourite colour are soft hearted and are head strong."); break; case White: System.out.println("Peoples with White as their favourite colour are benevolent and loving ."); break; case Pink: System.out.println("Peoples with Pink as their favourite colour are beautiful and intelligent."); break; } } }
Output