Java Programming: Lesson 36 - Modified Constructor Calls and Comparable смотреть онлайн
PLEASE SUBSCRIBE!!!
In the previous lesson (https://youtu.be/dEDs5n2PXKo), we discussed interfaces in Java, which allow only abstract methods and no concrete methods. This makes them unlike abstract classes, which allow both abstract methods and concrete methods, much unlike concrete classes, which only allow concrete methods and no abstract methods.
Calling super( x + "cat" , y.length() ) as the first line in a constructor in a subclass looks for the constructor in the superclass that accepts a String and an int, concatenates the user's input (what they pass in when the subclass is instantiated) with "cat" for the first input to the superclass's constructor, and then calculates the length of the user's second input to pass into the second input of the superclass's constructor. It then uses the methodology from the superclass's constructor. The point is that you can modify constructor calls by changing data types, concatenating things like "cat", or simply altering the value of a variable being passed in. You can do this with calling the METHODS of superclasses too, like super.f( "sup" ) [neglecting the user's input in a method that accepts an input] or super.f( x+1 , y+1 , z+1 ).
Comparable is an interface in Java that has one abstract method called compareTo. It returns an int and defines what it means for one instance of a class to be less than another instance of a class. This definition is not "provided" in the interface because the method is abstract. Thus, any class that implements Comparable must define a compareTo( ) method that shows that it means for one instance of a class to be less than another instance of a class.
Eventually, this will enable us to use methods like Collections.sort(list) to sort an ArrayList of objects for any class, but that is for a future lesson.
6:17 NEW: Modified Calls to a Constructor in the Superclass
15:06 NEW: The Comparable Interface
Using compareTo( ) to compare instances of a class is kinda like using the __lt__ method in Python: https://youtu.be/HhjjMILzOsg
This video also loosely aligns with another equivalent lesson in Python, regarding class methods, which can instantiate an object with modified parameters into the constructor: https://youtu.be/35LFYeDAc1o
Just 2 videos left on OOP...here's one of them: https://youtu.be/vrjGwTGksl8 (Lesson 37)
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Programming: Lesson 36 - Modified Constructor Calls and Comparable» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.