This question already has an answer here:
- Java getMethod with subclass parameter 2 answers
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