Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Temp {
- public static void main(String[] args) throws ReflectiveOperationException {
- class C {
- public C(String a, String b, String... c) {
- }
- }
- C c1 = new C("a", "b", "c", "d");
- java.lang.reflect.Constructor<C> constructor = C.class.getConstructor(String.class, String.class, String[].class);
- C c2 = constructor.newInstance("a", "b", new String[]{"c", "d"});
- C c3 = constructor.newInstance("a", "b", "c", "d"); // exception!!!
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment