RUVIDEO
Поделитесь видео 🙏

Java Classes and Objects - OOPs concepts

📁 Лайфстайл 👁️ 16 📅 04.12.2023

Classes are fundamentals of an object-oriented language such as Java. They contain members that store and manipulate data

Objects has state and behavior which are used to model real world objects
Classes are divided into top-level and nested.
Nested classes are classes placed inside another class that may access the private members of the enclosing class.
Nested classes include member classes, local classes and anonymous classes.

Class Bar is inner class
Static class Bar is nested class
Class in a method i.e. Foobar is Local class
Anonymous class is Creation of a new Object in a method.

declaring classes:
class MyClass {
// field, constructor, and
// method declarations
}
class MyClass extends SuperClass implements SomeInterface {
// field, constructor, and
// method declarations
}

Class instantiation
To create objects, the class must be instantiated by using the new operator and calling the class constructor.
Foo foo = new Foo();
Members of both instances and static classes are accessed with the (.) operator.

String foo = "Hello";
String bar = foo.toUpperCase();

Modifiers:
abstract - Specifies that a class only serves as a base class and cannot be instantiated.
static - Used only for member classes.
final - Classes marked as final cannot be extended from and cannot have any subclasses.
strictfp - Specifies that all floating-point operations.

The access modifiers, or inheritance modifiers, set the accessibility of classes, methods, and other members. Members marked as public can be reached from anywhere.
If a class or its member does not have any modifiers, default access is assumed.

A constructor is a special method called when an object is initialized. Its purpose is to initialize the members of the object.
Initializers are blocks of code that are executed when a class or an instance of a class is created. There are two kinds of initializers, static initializers and instance initializers.
Static initializers initialize static fields when the class is created.

They are declared using the static keyword:
The main differences between constructors and ordinary methods are that constructors are called only when an instance of the class is created and never return anything. Constructors are declared as common methods, but they are named after the class and no return type is specified:

All the statements in Java must reside within methods which belong to classes. A method has a return value, a name and usually some parameters initialized when it is called with some arguments. Similar to C++, methods returning nothing have return type declared as void. Unlike in C++, methods in Java are not allowed to have default argument values and methods are usually overloaded instead.
/* Overloaded method is method with the same name but different set of arguments */
Method modifiers:
abstract - Abstract methods can be present only in abstract classes.
static - Makes the method static and accessible without creation of a class instance.
final - Declares that the method cannot be overridden in a subclass.
native - Indicates that this method is implemented through JNI in platform-dependent code.
strictfp - Declares strict conformance to IEEE 754 in carrying out floating-point operations.
synchronized - Declares that a thread executing this method must acquire monitor.
Access modifiers - Identical to those used with classes.

Field variables
Fields, or class variables, can be declared inside the class body to store data.

Overriding
If subclass has the same method as declared in the parent class, it is known as method overriding

An Abstract Class: is a class that is incomplete. Methods that are declared but not yet implemented.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Classes and Objects - OOPs concepts», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.