Java examples for Reflection:Constructor
has Default Constructor
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { Class clazz = String.class; System.out.println(hasDefaultConstructor(clazz)); }/*from w w w.j av a 2 s . co m*/ public static boolean hasDefaultConstructor(Class clazz) { try { clazz.getConstructor(new Class[0]); return true; } catch (NoSuchMethodException ex) { return false; } } }