Popular Posts
Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement... javax.net.ssl.SSLHandshakeException: Connection closed by peer in Android 5.0 Lollipop Recently, there is a error occurs when access website via ssl connection like below although it worked fine several days ago. // Enable SSL... Tired of Hibernate? Try JDBI in your code JDBI Quick sample ICategoryDAO.java : create a data access interface (implement is not required) package com.prhythm.erotic.task.data....
Stats
Create instance using Class
import java.lang.reflect.Constructor;

public class Case012 {

    /**
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        // TODO Auto-generated method stub

        // General way to create a new instance
        // Case012 c = new Case012("dddd");

        Class c = Class.forName("sb.test.c010.Case012");

        Constructor constructor1 = c.getConstructor(String.class);
        constructor1.newInstance("test");

        Constructor constructor2 = c.getConstructor(int.class, int.class);
        constructor2.newInstance(10, 20);
    }

    public Case012(String s) {
        System.out.printf("Create instance with string parameter : %s", s);
        System.out.println();
    }

    public Case012(int x, int y) {
        System.out.println("Create instance with two int paramters.");
        System.out.printf("Sum of two number is : %d", x + y);
        System.out.println();
    }
}