레벨별 추가 레슨

사용 가능

Java의 제네릭이란 무엇입니까?

이 단원에서는 제네릭에 대해 이야기합니다. 또는 제네릭으로 뛰어들 때 알아야 할 기본 사항에 대해 설명합니다. 제네릭이 무엇이고 왜 필요한지입니다. 주제는 매우 중요하며 반드시 이해해야 합니다. 앞으로!

고양이용 제네릭

제네릭은 개발자가 형식 안전성과 유연성을 위해 컴파일러에 추가 정보를 암시하는 데 도움이 되는 훌륭한 도구입니다. CodeGym 커뮤니티의 회원이 작성한 이 심층 문서는 "제네릭"에 대해 한 번 더 설명합니다.

유형 삭제

이 단원에서는 제네릭의 일부 기능과 함께 작업할 때 발생하는 함정에 대해 다룹니다. 제네릭은 언어가 생성될 때 Java의 일부가 아니었기 때문에 유형 삭제가 추가되었습니다. 저게 뭐야? 우리는 그것을 알아낼 것입니다.

제네릭의 와일드카드

와일드카드는 제네릭의 매우 중요한 기능이며 확실히 별도의 학습이 필요합니다 . 이것은 흥미롭고 간단한 주제입니다. 당신은 그것을 좋아할 것입니다 :)

제네릭으로 작업할 때 varargs 사용

제네릭과 함께 varargs를 사용하면 힙 오염이라는 불쾌한 결과가 발생할 수 있습니다. 이 단원에서는 Java에서 제네릭의 다양한 기능에 대한 논의를 마칩니다.

4
과제
Java Core,  레벨 5레슨 4
잠금
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
과제
Java Core,  레벨 5레슨 4
잠금
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
과제
Java Core,  레벨 5레슨 4
잠금
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
과제
Java Core,  레벨 5레슨 4
잠금
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
과제
Java Core,  레벨 5레슨 4
잠금
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.
코멘트
  • 인기
  • 신규
  • 이전
코멘트를 남기려면 로그인 해야 합니다
이 페이지에는 아직 코멘트가 없습니다