I don't get why the below code is not working?
Could anybody assist?
I have also tried with
public static void printObjectType(Object o) {
//write your code here
System.out.println("Solution." + o.getClass().getCanonicalName().substring(33));
}
package com.codegym.task.task12.task1204;
/*
Whether it's a bird or a lamp
*/
public class Solution {
public static void main(String[] args) {
printObjectType(new Cat());
printObjectType(new Bird());
printObjectType(new Lamp());
printObjectType(new Cat());
printObjectType(new Dog());
}
public static void printObjectType(Object o) {
//write your code here
System.out.println("Solution." + o.getClass().getSimpleName());
}
public static class Cat {
}
public static class Dog {
}
public static class Bird {
}
public static class Lamp {
}
}