Mình đang tìm hiểu Try cath throw exception trong Java
Mình cố tình để ngoại lệ không tồn tại phương thức xảy ra trong đoạn Code
Rồi mình try catch cái NoSuchMethodException e
Nhưng vẫn lỗi là sao các bạn
Thanks
Lỗi khi dùng exception NoSuchMethod trong Java
First, don’t post screenshots of code. It looks bad, is hard to read, and is rude.
Second, you misunderstand reflection in Java. The NoSuchMethodException is thrown when you try to call a method via reflection with an unknown method name. What you have done here is calling an UNKNOWN method. This has nothing to do with calling via reflection. That is why you get the message “The method ren() is undefined”
3 Likes
Thank you for your opinion