I am trying to do a bit of reverse engineering on enum.
public class test {
public static void main(String[] args) {
num number=num.one;
System.out.println(number); //outputs result as one
}
}
enum num{
one;
}
Now how do I implement the same without using enum.
public class Lab24a {
public static void main(String[] args) {
num1 num= num1.one;
System.out.println(num);
}
}
class num1{
public static final num1 one= new num1();
private num1(){
}
public String toString(){
return //how to implement the two string totally lost here.
}
}
I was able to write a code until this, but I am not able to printout the value, please give me your suggestions or hints. I even tried looking at the following links.