Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static <T> T castObjectOrThrow(Object o, Class<T> clazz) {
        try {
            return clazz.cast(o);
        } catch (ClassCastException e) {
            throw new ClassCastException(o.toString() + " must implement " + clazz.getSimpleName());
        }
    }
}