AkhmadGhafirin
5/1/2017 - 10:25 PM

Class Cast

package exception;

/**
 * Created by ahmad on 30/04/17.
 */
public class ClassCast {
    public static void main(String[] args) {
        try {
            Object x = new Integer(0);
            System.out.println((String)x);
        }catch (ClassCastException e){
            System.out.println("Class Cast Exception!");
        }
    }
}