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

✔ How To Create and Use Java Objects | (Video 34)

In Object-Oriented Programming (OOP), a class defines the form of an object. Therefore, each object is a template of a class that contains a blueprint of all the object’s characteristics. Those characteristics are data and code. The code operates on data inside of a method.

► Java Book (pages 16 - 29) = https://tinyurl.com/Rex-Part2-Java-Book
► Free Selenium PDF Book: https://www.rexjones2.com/book-selenium-4-beginners/
► Free Java PDF Book: https://www.rexjones2.com/book-part-1-core-java/
► All Paperback & eBooks: http://tinyurl.com/Rex-Allen-Jones-Books

► View All Videos On LinkedIn = https://tinyurl.com/LI-Selenium-4-Beginner-Videos
► View All Videos On YouTube (Caption or Non-Caption) = https://tinyurl.com/YT-Selenium-4-Beginner-Videos
► View All Videos On Facebook (Caption or Non-Caption) = https://tinyurl.com/FB-Selenium-4-Beginner-Videos

► Increase Video Quality: Settings - Quality - Select HD
► CC Font Size: Settings - Subtitles/CC - Options - Font Size
► Turn CC On or Off: Click CC

► Transcript
Let’s start with how to create and use objects.

In Object-Oriented Programming, most classes have data and methods. The class is Car. Data will be instance variables int price and int tax. Our method will be calculateCost (public void calculateCost), which has a task of adding the price and tax. (int cost = price + tax) After assigning the value to cost, we print the cost by writing sysout “What Is The Car’s Cost? $” + cost

In a different class, we have a main method to create our objects. Car coupe, minivan, sedan. coupe, minivan, and sedan are the type of Cars. The Data Type is Car while coupe, minivan, and sedan refer to the Car type.

Do you remember from the previous video “Understanding Java Variables & Operators”? We declared a double Non-Object Data Type and amount as the variable then initialized the variable with 23.45. We can do the same with Object Data Types.

I’m going to take this, one at a time and erase minivan and sedan then write coupe = new Car (). The 1st line declares coupe as a reference to an object of type Car. That’s why we call coupe an object reference variable because it is a variable that refers to an object. The 2nd line creates a new Car object and assigns a reference to coupe. These 2 lines can be written as Car coupe = new Car (); Let’s create one more for minivan. Car minivan = new Car.

Coupe and minivan refer to the Car object. As a result, the Car Object is a template of the Car class. So, check this out, since the Car class has price, tax, and the ability to calculate the cost. Coupe will have its own price, coupe will have its own tax and coupe will have calculateCost. The same with minivan. Minivan will have its own price, tax, and calculateCost. Objects are copies of a class which allows each object reference to have its own copy.

Therefore, we can write coupe dot. The dot operator provides access to its copy of variables and methods. Notice the intellisense shows price, tax, and calculateCost. This shows, that we can assign values to price and tax. coupe.price = 14000; coupe.tax = 1000; then call the calculateCost method: coupe.calculateCost;

Here’s what happen when coupe calls the calculateCost method. Our code will assign the price and tax to coupe, call calculateCost method, add both values within the method, assign the value to cost then print the cost of coupe. Let me show you by debugging.

First, we add a breakpoint by double clicking the line or shortcut CTRL + SHIFT + B. A breakpoint is the blue dot in front of the line number. Let’s Debug. Debug has stopped at price. The coupe’s price and tax are set to 0. F5 steps into our code. 14000 is assigned to price. F5 again then tax is assigned 1000. Coupe is getting ready to call the calcuateCost method. F5 – Debug moves to the calculateCost method to add our price and tax. F5 and now we see cost is assigned 15000. Next, we print the cost “What Is The Car’s Cost? 15000”

The same happens for minivan. Let’s assign 9000 to the price of minivan: minivan.price = 9000; minivan.tax = 1000 then we calculate cost for minivan. minivan.calculateCost. Remove the Breakpoint and Run again. coupe is 15000 and minivan is 10000

#SeleniumTraining #SeleniumAutomation #BeginnerSeleniumTutorials #SeleniumWebDriver

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «✔ How To Create and Use Java Objects | (Video 34)», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

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

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

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