mardi 27 septembre 2016

Why does this constructor throw a NoSuchMethodException with reflection? [duplicate]

This question already has an answer here:

I've tried this code:

System.out.println(java.util.Scanner.class.getConstructor(System.in.getClass()));

but I get this error and I do not understand why:

Exception in thread "main" java.lang.NoSuchMethodException: java.util.Scanner.<init>(java.io.BufferedInputStream)

even though 'new Scanner(System.in)' works





Aucun commentaire:

Enregistrer un commentaire