About Question enthuware.ocpjp.v11.2.1820 :
Moderator: admin
-
- Posts: 22
- Joined: Thu Dec 09, 2021 11:23 pm
- Contact:
About Question enthuware.ocpjp.v11.2.1820 :
Hello, Question. should it be List<Integer> newList vs List newLlist. Will it not require Object type? Thanks.
-
- Site Admin
- Posts: 9804
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.1820 :
No, not necessary. You can always assign a parameterized type to a non-parameterized type. i.e. List<Integer> can be assigned to List. There will be a warning but it is allowed.
You can try compiling and running the given code and see what happens.
You can try compiling and running the given code and see what happens.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: Google [Bot] and 4 guests