Code example for Constructor

Methods: newInstance

0
 
        if (stringConstructor != null)
        { 
            try 
            { 
                s = stringConstructor.newInstance(0, c.length, c);
            } 
            catch (Exception e)
            { 
                // Swallowing as we'll just use a copying constructor 
            } 
        } 
        return s == null ? new String(c) : s;
    } 
 
    /** 
     * Used to get access to protected/private constructor of the specified class 
     * @param klass - name of the class 
     * @param paramTypes - types of the constructor parameters 
     * @return Constructor if successful, null if the constructor cannot be