CodeGym/Java Course/Modulo 2: Nucleo Java/Lezioni aggiuntive al livello

Lezioni aggiuntive al livello

Disponibile

Cosa sono i generici in Java?

In questa lezione parliamo di generici. O meglio, sulle nozioni di base che devi sapere quando ti immergi nei generici: cosa sono i generici e perché ne hai bisogno. L'argomento è molto importante e devi assolutamente capirlo. Inoltrare!

Generici per gatti

I generici sono un ottimo strumento per aiutare gli sviluppatori a suggerire informazioni aggiuntive al compilatore per l'indipendenza dai tipi e la flessibilità. Questo articolo di approfondimento , scritto da un membro della community di CodeGym, fa un altro giro sui "generici".

Digitare la cancellazione

Questa lezione è dedicata ad alcune caratteristiche dei generici e alle insidie ​​che sorgono quando si lavora con essi. Poiché i generici non facevano parte di Java quando è stato creato il linguaggio, è stata aggiunta la cancellazione del tipo. Che cos'è? Lo scopriremo.

Caratteri jolly nei generici

I caratteri jolly sono una caratteristica molto importante dei generici e meritano sicuramente una lezione a parte . Questo è un argomento interessante e semplice. Lo adorerai :)

Utilizzo di varargs quando si lavora con i generici

L'uso di varargs con generici può portare a conseguenze piuttosto spiacevoli: l'inquinamento da mucchio. In questa lezione , concludiamo la nostra discussione sulle varie caratteristiche dei generici in Java.

4
Compito
Java Core,  livello 5lezione 4
Bloccato
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
Compito
Java Core,  livello 5lezione 4
Bloccato
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
Compito
Java Core,  livello 5lezione 4
Bloccato
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
Compito
Java Core,  livello 5lezione 4
Bloccato
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
Compito
Java Core,  livello 5lezione 4
Bloccato
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.
Commenti
  • Popolari
  • Nuovi
  • Vecchi
Devi avere effettuato l'accesso per lasciare un commento
Questa pagina non ha ancora commenti