Popular Posts
Word break tag : <wbr/> (HTML5) The  HTML  <wbr>  tag  is  used  defines  a  potential  line  break  point  if  needed.  This  stands  for  Word  BReak. This  is  u... CTE, recursive search WITH DepartmentSearch(DeptID, DeptParent, DeptName, OuID) AS (     -- 找出簽核者所屬部門     SELECT d.DeptID, d.DeptParent, d.DeptName, d.OuID     FR... Create web service client cross SSL with eclipse When creating web service cross SSL using eclipse, it occuss some error like below: And it can't build the client source from this wa...
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();
    }
}