Why it's possible to instantiate String and not possible for Number(Long,Double,Integer...)?

Viewed 159

Hi why it's possible to instantiate String and not possible for Numbers .I have made an example for that

public static void main(String[] args) throws InstantiationException,
        IllegalAccessException {
    String a = "s";
    String newInstance = a.getClass().newInstance();
    System.out.println(newInstance);
    Double b = 0d;
    Double newInstance2 = b.getClass().newInstance();
    System.out.println(newInstance2);
}
2 Answers
Related