- compile : A a = new A()
- hoặc runtime A a = class.forName(A.class)
Về cách chạy ai cũng hiểu là compile chạy trc, runtime chạy sau. Vậy khi nào ta cần tạo object theo kiểu nào ạ
Thank anh Dũng
We want to connect the people who have knowledge to the people who need it, to bring together people with different perspectives so they can understand each other better, and to empower everyone to share their knowledge.
Về cách chạy ai cũng hiểu là compile chạy trc, runtime chạy sau. Vậy khi nào ta cần tạo object theo kiểu nào ạ
Thank anh Dũng
A a = new A()
vì A a = A.class.newInstance()
hoặc A a = (A)Class.forName("A").newInstance()
sẽ sử dụng reflection và nó rất chậm.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Input your email to receive reset password link, or if you remember your password, you can click