All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jtransc.bug.JTranscBug127 Maven / Gradle / Ivy

package jtransc.bug;

import java.util.Arrays;
import java.util.List;

public class JTranscBug127 {
	static public void main(String[] args) {
		testNonNull("hello");
		testNonNull(null);
		testNonNull(10);
	}

	static public void testNonNull(Object test) {
		try {
			Integer t = (Integer) test;
			System.out.println("No exception");
			System.out.println(t);
		} catch (ClassCastException e) {
			System.out.println("ClassCastException");
		}

		try {
			List t = (List) test;
			System.out.println("No exception");
			System.out.println(t);
		} catch (ClassCastException e) {
			System.out.println("ClassCastException");
		}

		try {
			byte[] t = (byte[]) test;
			System.out.println("No exception");
			System.out.println(Arrays.toString(t));
		} catch (ClassCastException e) {
			System.out.println("ClassCastException");
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy