CodeGym/Cursos Java/Módulo 2: Núcleo de Java/Conferencias adicionales al nivel

Conferencias adicionales al nivel

Disponible

¿Qué son los genéricos en Java?

En esta lección , hablamos de genéricos. O más bien, sobre los conceptos básicos que necesita saber cuando se sumerge en los genéricos: qué son los genéricos y por qué los necesita. El tema es muy importante, y definitivamente necesitas entenderlo. ¡Adelante!

genéricos en dos palabras

Los genéricos son una gran herramienta para ayudar a los desarrolladores a sugerir información adicional al compilador para la seguridad y flexibilidad de los tipos. Este artículo detallado , escrito por un miembro de la comunidad de CodeGym, da otra vuelta alrededor de los "genéricos".

Borrar tipo

Esta lección está dedicada a algunas características de los genéricos, así como a los peligros que surgen al trabajar con ellos. Debido a que los genéricos no formaban parte de Java cuando se creó el lenguaje, se agregó el borrado de tipos. ¿Qué es eso? Lo resolveremos.

Comodines en genéricos

Los comodines son una característica muy importante de los genéricos y definitivamente merecen una lección aparte . Este es un tema interesante y sencillo. Te va a encantar :)

Usar varargs cuando se trabaja con genéricos

El uso de varargs con genéricos puede tener consecuencias bastante desagradables: contaminación del montón. En esta lección , concluimos nuestra discusión de varias características de los genéricos en Java.

4
Tarea
Java Core,  nivel 5lección 4
Bloqueada
Something superfluous
Our program is once again full of unnecessary lines of code. Let's correct this blunder by removing all the extra methods, so that the program displays text (and only the text) that corresponds to the task conditions. By the way, you need to get used to this. Junior developers' special ability to create unnecessary code is pretty annoying to senior developers.
8
Tarea
Java Core,  nivel 5lección 4
Bloqueada
OOP: Method overloading
Let's display matrices in different ways, however we want. OOP gives us a wonderful tool for this: method overloading. Overload the printMatrix method in 8 different ways. You should end up with 10 different printMatrix methods.
4
Tarea
Java Core,  nivel 5lección 4
Bloqueada
OOP: Method overloading - Eliminating the superfluous
Not every overloaded method is useful. And so it is in this program. Look at the code and think about which implementation of the print method will be called. Then remove all the superfluous implementations of the method - and you're done.
4
Tarea
Java Core,  nivel 5lección 4
Bloqueada
Man or woman?
Something in this program isn't right... It seems to display the names of men, but not those of women. Put an end to the discrimination: change the printName method so that it runs for both man and woman. The method should have a single implementation.
4
Tarea
Java Core,  nivel 5lección 4
Bloqueada
Be gone, all that is unnecessary!
Again, we have extra lines in a program. They've resulted in a bug, because the program tries to call the add method for cases for which it is not implemented. We won't override the superfluous add methods this time. We'll do something simpler: delete the lines for which there is no implementation.
Comentarios (1)
  • Populares
  • Nuevas
  • Antiguas
Debes iniciar sesión para dejar un comentario
5 junio, 05:04
Ningún enlace direcciona a los temas que indican hay información adicional respecto a genéricos