Transcripts
1. Introduction: Hello. If you are asking yourself each time when you learn something new, why it really exists? Like, for example, why doing classes? I do. We need loops. Why they're constructed like that and so on. And so then you're in the right place because I will explain you everything. The easiest possible way from scratch. I believe that everyone has the ability to develop software. If they are a properly and it's including you, I'm going to give you the context of itching concept. I tease you, and after my cars you would finally understand everything. Did you go? I would like to present your video curse Java that does get over 60 lessons and it's overnight hours of content and it's also very well organizing to 30 sections. Head with quizzes, exercises and you might be asking now. Well, you wouldn't know after these girls what you will know semantic of job, which means meaning off words in Java. This is very important part because if you have sold basics, it will allow you to create whatever you want. You will be fluent in Java language after discovers, okay, and this is the most important part for every programmer. If you want to create your own applications in future, you understand things like the rebels operators. Conditional statements mattered. Zarate subject. Look, I will go through, For example, new features like Lambda Expressions from Java. Eight arrow handed exceptions. And you will I know lots of things about object oriented programming. And it's not like giving on annoyed because I am no reading the good to confrontation. I will give you Heene's. I would tell you why something exists. Why do we need inheritance? Why do we need interfaces? How do we use them? When should we use them and other things like that? Okay, so this is not just well next cars with somebody's reading. Take the commendation. No, I am going to give you kings. I'm going to tell you when and why you should use something. Why? Something is important for you. Okay, so this is very different course, And you might be asking yourself why should you choose my cards? Right? Here are some things that you can read about, but I would tell you also that I have enormous experience in teaching other people and I do it as you have probable rather not this a bit different way. I always explain everything from start catch, and I do not omit anything. If you do not believe me, then please go ahead and watch free preview videos. I even exist towards free videos before buying anything. I'm sure that you will be satisfied with my cars after completing you. And, well, it's really, really cheap. Comparing toward you can achieve after discovers after discussing, we have knowledge. And what is the most important ability to read Java language? You know how to read Java libraries. You can create whatever you want. You have any questions, Please feel free to ask. You can send me a message, and I will respond as fast as possible. You can ask me about programming but taking my place that I am not doing homework. But I would be happy to give you Heene's, and you might be asking yourself what you should know before this girl's well, this empty patch is suggesting that you do not need to know anything, so these can be your first language. It doesn't matter. It's for beginners. But also, if you have a program, something in Java doesn't mean that it won't be useful because I'm showing things that are rarely seen in, you know, places on the Internet. Because I'm giving you kids. I'm telling you why something really is important. If you know if you are creating your programs and you don't know exactly what to do next and you're trying to copy called from Someplace, then it's wrong. I you should create your coat on your almost time when it So it should be easy for you. And that's what I'm trying to achieve in discovers. Okay? And you are and be asking also yourself. Who is that? This all tore disc person? Well, my name is our cattle grid Atrix. As you can see, I have wars of experience in the matter. I'm also author of many video courses I love. I really laugh, teaching other people okay, there are many. Collins confined them them on my other courses on the Internet. This is almost impossible to not be satisfied with this current. If you have any questions, just ask me. That's only good lesson and have a good day
2. What is Java?: Hello, my friend. Today, I
will tell you, what is Java? What is programming language? What is Java virtual machine? What is the compiler, and
many other things like that. Okay? These are basics, and this lesson is
very, very important. In order to understand anything
in Well, any language, not only Java, if you want
to understand programming, you have to watch
this lesson, okay? After this lesson, everything
is going to become clear. Okay, so what is Java? Java is a programming
language that we use to talk with our computers. Our computer is talking in a bit different language
than we are talking. I'm talking in English
language right now, and you understand
me pretty well. But our computer likes
things like that, zero, one, zero, one, one, one,
one, zero, 011-11-1111. Why? Because these are
electric impulses, well, they jump 0-1, and that's how computer is interpreting everything
that you see right now. It interprets the
sequences of zero and one. Will be very hard for us to write programs
like that, right? To imagine writing things like that, that
would be horrible. That's why we have
got something what is called programming
languages that are, you know, having syntax
that is you know, easy to understand for us. It is not as easy as, for example, right
now, English, right? But it's going to be easy
if when we learn the rules, like we learn, for example, for English, right
or another language. Well, we're just going
to be able to talk. For example, we can write later
something like integer B. It means, Hey, you know, I want to save in the
random axis memories, so in the RAM place
for the integer. It means I want to save
a number somewhere. I want to find a
place like that. This thing would mean I want to reserve
something for computer. It needs to be also
changed to 010101. The process of changing this into 0101 is called compilation. Programming language
is something that is understood by us. As syntax, this can be easily changed into
zero and one, right? And why did I put so much effort to tell you what is the
programming language? Because in Java, the process of compilation is a bit different. It's very hard to understand
for people new to Java. And some people do not even
understand it after you know writing programs
in Java for many years. Okay. So what's going on here? You know, normally,
let's for example, see here programming language
like C plus plus, right? When you write a code, okay? So imagine here we have
got some kind of code. So we have got
something like that, and B or other things
like that, or, you know, something
like that in Java, whatever, we have got
some kind of code here. And this code is going to
be changed by something, what is called
compilation, right? So we can write
compilation, right? So this thing is going to be changed into the
zero and one, right? Zero, one, zero, one, zero, one. Well, this code is called machine code is going
to be executed. There is a small problem in the CPS plus solution,
because, you know, there is windows,
there is linux, there is makintos, android and other things and other
platforms like that. The problem about it is that when you make that
compilation, right? So we changed this code
into the zero and one, it needs to know the
processor that is going to execute the instructions
here written in that code. And because of it, when we compile it
on, for example, windows, it's going to be
able to run on on windows. So you have to later compile it also on, for example, Linux. The problem is also
that on Linux, you can have libraries
that are not, for example on windows, and you can have on windows libraries that are not
available on Linux, and then you have to
write code many times. Wow. This is horrible, right? If you want to support
many platforms. The cool thing about Java, and that's why it's one
of the most in demand and highest paying programming
language is that the slogan on Java is right
ones and work everywhere. Why and how did they
manage it? Well, Java Is doing something like that. When you have got a code, we have got a code like that, we have got a process
that is going to change this code into something, what is called bite
code, bite code. It is something between the
code that we have got here. And that we have got here
zero, one, 01, right? That byte code is
not going to be useful for us humans because
well, we cannot read it, but it is very
nicely written code, that is going to be interpreted
by something what is called Java machine, okay? This is a program. This is a application that
you can install, there is a platform
that you can install on any computer on
Android on Linus, this thing is going to change
bytecode into zero and one. And that's cool. It's going to change
this thing into bytecode that can be interpreted
on any platform. That's why it's so awesome. But you have to
also remember that you have to install this
Java virtual machine. Without Java Vt machine. It's going to, you know, you're not going to
be able to run it. We're going to inst
later something like that, that's
called Ned Bin. It's an editor that allows you to write a
code in places like that. And this code is
looking like that, public class Java application. We're going to talk what
what is public meaning, what is class and other
things like that, right? We're gonna click
play like here. And it's going to
compile this thing. So this code the
programming language into something what is
called a byte code. And then the byte
code is going to be run by Java virtual machine
in time, just in time. Because, well, you, you
might be like, now, A, this must be very slow, and you are right, it is slower than the C
plus plus solution. You have to choose this or this, you want speed or you want
to support all platforms. But it's not also very, very slow because For example, when you have got a code
that looks similar, right, then it's going to create in the byte code
special instructions that is going to make
it simpler, right? It's also not going to compile all your code if some of the instructions
are rarely used. If something is going
to be used very often, it's going to even sometimes
run faster than in SP plus, because it's going to
create special connections that are going to run things
that are run very often. So it really depends
on situation. Java is most time slower. Sometimes it might be even
faster than CPlS plus. But the truth is that
you shouldn't worry about it because
our computers are faster and faster each day. If you want to
write applications, desktop applications
or for example, Android applications, things
like that do not matter. If you have to write drivers
where speed really matters, then CPlS plus and other languages are like CPlS
plus are very important. Remember that even games
are written in Java. For example, popular game like Minecraft was
created in Java. So you have to
know that there is a process that is called
compilation here, right? So the compilation
is changing code from one type of code
to another code, right? And compilation also, you know, check if you made some errors. So if I do something
like that, that you can see and when I click play, Hi, there are some
errors, right? It helps you debug your code. So you can find
bugs, the problems, the errors in your code talk about things
like that also later, we will install the IDE integrated
development environment, so this editor that has
got lots of useful tools. We'll talk about all
these things later. In this lesson, you right now know what is
programming language. The programming language is
used to create programs. So instructions that
are going to be executed after changing into the machine code
by our computer. So we are giving requesting
computer what to do. It's like forcing him to do. It's commanding him, Hey, do something like, hey, go into the system and then out of it and
then print a line, like, for example, hello word. And when when I click play, as you can see, we have
got here, hello word. We'll talk about why he is
a dot, why he is a public, how these rules work
with each other. In next lesson. Remember that if you
have any questions. Just ask me, I really love
helping other people. That's only the
desson. Thank you.
3. Who am I: Hello, my friend. You might be wondering if it is worth to learn from me. Who is the person who's gonna teach you in these cars? Well, my name is our cathedral dodging, and I have got lots of experience in programming and Web development. As you can see, over 20 years stand in programming and 14 years time in developing websites, and I've also created lots of video courses. So I have got lots of experience in creating video courses, 27 in Poland and seven in English. I am teacher off thousands off satisfied customers. There are lots off sample comments about my courses, and all off them are positive. There is no bad review off my courses because I always try to explain everything from the bottom of my heart. I love teaching other people. Really. If you have ended to tell any questions regarding cover topics, please just ask me. I really love helping other people. I will help you because well, that's what I shall do, right? If I do something wrong way. If you know I teach Abed way some some something the bed way, the way that you will not understand it means that it is only my fold, right? It is my fault. Did I told you it the bed way? I have to do it a bit different way in order to make you understanding. Okay, So if you have any questions, feel free to ask. If you do not like my course, you can take a full refund after 30 days time. That's only that lesson. Thank you very much.
4. Downloading and installing IDE and JDK : Hello, my friend. In the previous lesson, you learned what Java is. So you already know that it
is a programming language, and it's time to start using it. However, to do so, we need somewhere a place
to write the code, right? So you need an editor, and it would be great if that editor could suggest
would you did wrong. Color the code to make
it more readable, complete some parts of the
code for you and so on. And in this lesson, I will show you how to download such editor. But you also need something
is called a compiler, which we talked about in
previous lessons, right? The idea is to transfer the code you write into
intermediate code, which will later be understood and interpreted by something good is called Java
virtual machine, right? So we also need to download
the Java virtual machine, which is included in something that we'll talk about soon. And that's exactly what we
will do in the lesson, okay? So so many things to do in order to start
programming, don't you think? I believe that one of the coolest editor is
called Net Bin, okay? So you can download it
from the site like this. However, you can use
other editors, okay? You can use Visual
So IntelliJ clips. So whatever editor you
choose, it's up to you. The choice is yours.
These editors should be, you know, they should suit you. If you don't like net
beans, then choose other. It doesn't mean that if you are learning from MCorse you won't understand something because you are using a different editor. No, no, no, no, no, no.
My course is universal. You can use any editor
in any version. We are learning the
language right now, okay? We're not learning the
advanced functions of editors, just the ones that are
mainly use basic ones. So before we download
Net Bins or any editor, unfortunately, none of them will work without something
what is called JDK. Okay? What is JDK, JDK stands for Java
development kit. Kit means a set, right? Development refers to design. So it's a set of tools for
designing programming in Java. It has everything. Without it, you simply can't move forward. To run Java program, you need a Java
random environment, and it's also included
in JDK, okay? And Javaual machine, which
is also included in JDK. So you need all of the things. A lot of abbreviations I
have just said, right? A lot is happening, and I know I know I said
a lot of things, and it was probably quick. And honestly, for
you as a beginner, it really doesn't
matter if you know how all these abbrevation shortcuts
differs from each other. This theory discourages
you, don't worry. You don't need to understand it 100% at this current moment. Just focus on the
programming itself because this is amazing, okay? And I will present you it
in next lectures, okay. And this will start
becoming enjoyable. You will come back to this topic about what is JDK and
other things like that. Later someday, and you
will understand it probably better because you will have knowledge
regarding programming. For now, just install everything according
to the instructions in this lesson and
enjoy programming because it's really
beautiful thing to do. Let's download JDK. Firstly, we need to download JDK because NetBeans doesn't work without it, right? So we'll use the site which
is called adopting.net. It's really cool
because it allows you to hit here as you can see, other platforms and versions, and you can choose easily
very fast your system. So if you have Linux, this, mark, this, Windows, this, and here you can
choose the version of JDK we are going to use. And this is very important
because when you go to the Net Beans and right
now the version is 20, but it goes very fast up. Don't worry about the version
here because it doesn't really matter from the
programming perspective. But it matters for you
because here down, you can see that it
supports JDK 11, 17 and 21. So we need to focus
on one of them. But, 21 is the newest one, so let's choose the newest one. LTS means long term supported. So it means that this
version is going to be supported very
long and updated. So it's best to choose one of this version and then
click on this thing. Now our JDK, including
Java time environment, and so on, is being
downloaded, okay? And here we need to
download for Windows, you click this for the
market T, for Linux this. We're going to click on Windows, and let's download it. So after downloading
it, we need to firstly, it's very important
install JDK, not Net Bins. Okay? So let's click
on the Fink here. Run the program. And now
we click Next and it's super important to choose here will be installed on
Local hard drive. Because these two options are
by default not installed, and you can see it sets environment variable
in your Windows. And without it, you will need to manually later set in other programs the
path to this place, which is troublesome, right? Why bother? Let's just make the other programs
to find it itself. So let's kick finish. And now
let's go to the Nut Bins. Let's run it, and
let's wait a second. And we're configuring
the installer here, you can customize it. But we'll just click Next. It's very important to
read the license like I do accept the terms
and click Text. Afterwards, you've got here you can see instantly
the path to the JDK with installed because I added it to the
home environment variable. That's why I chose
the option before. Now, you just click
next Install, and to be honest, that's all. We're going to just
wait a few seconds. It can take a few minutes. It depends on your computer
speed right on the processor. So as I said earlier, this process is easy to do if you don't need to
understand what the JDCends on, right? We could just finish. Now we need to find the
installation and open it, right? This you can see, our
beautiful net bins is opened, and now we're going to
learn in future lectures how to create projects, how to create fights, how to program all
that collect stuff. And remember, if you
have any questions, I always love helping
others, ask them. Have fun.
5. Creating your first project: Hello, today, I will
show you how to create your first project
in Nbins In order to do it, you click on file
then New Project. And then from these categories, you can choose a template. So how your starting
code should look like, it's just going to help you. You don't need to
create basic fs each time again and
again, does it for you. As you can see, you can
program HTML in PHP. It's just up to you. NetBins is used also for
other programming languages. But we're going to
choose Java with A. What is A At is, you know, the small being just kidding. At is a build script to build, run, and debug your
project, okay? So there is also a great deal Maven. There are differences. To be honest, it doesn't
matter for you for now. What are these differences
between these building tools? Just use Ants. Stick with it. Don't worry about
these names here. So focus on Java with At, and we're going to choose Java application because we want to create Java applications. And then we click Next. And here we type the
name of our project. So for example,
name, of my project, and then I click Finish, and that's how
we've just created our first project that is
called Name of My Project. As you can see, ID, which is integrated
development environment, has got here lots of tools
that we need to learn about. For example, here
on the left side, we have got something like a project manager
where we can see folders with the files that
we are currently working on. We have got now only
one file that has been automatically created with
the template that we used. And this is entrance
to our program. As you can see, it says to us, to do code application
logic here. So when we write here something
like, for example, this, of course, don't worry,
what is that because we're going to explain it
better in the future. Well, I'm going to explain
it better in the future. And when you click Play
button, as you can see, we have just compiled
our program, we have builded it, and here we have a result.
That's cool, right? We didn't need to do
anything manually because everything was done by this integrated
development environment. Here there is lots
of other stuff, like, for example,
history, you can see, Oh, so I did today
something like this, so I changed this into this. So as you can see, it can
help you follow what you did in the current
day or the last day. There are many
useful stuff in IDE. We will focus on
a few of them in the future lectures step
by step. So don't worry. For now, and notice that IDE is also colorizing the key words, like, for example,
class, public. Of course, we're going
to talk about things like that in future.
What do they mean. But notice that because of it, your code looks better, right? You can instantly say, Oh, so here is a class Oh, so here
is a public thing, right? So here is my main thing. You can instantly
see where is what? Because it's
colorizing your code. That's not all, net
Bins can help you also spot errors
like for example, let's remove SQ as you
can see when we move here our course or class
interface are expected. Also, we expect here something
what is called class. Okay, now everything works fine. So when you make errors, you're going to be
informed about, let's remove the column
from here, expected. Okay, so let's add it back and our program works fine now. This is pretty cool,
right, because well, people tend to make mistakes and you're going
to make thousands of them. And this is pretty normal, especially if you
are a beginner. But even if you're advanced, you're going to make mistakes
while you are programming. This is normal, so do
not worry about it if you feel like you are
outcasts or something like that. Now, this is pretty
normal at the beginning, so don't worry about it. Okay, that's only a lesson.
Thank you very much.
6. Comments: Hello Today I would tell you what are comments and why it's worth to use them. So I have created a new project that I called Commons application. And as you can see, I have got here some coat. And between this coat, I have got Colman's like that. So everything that is colored in gray by the editor is a comment and it means that it is not gonna be interpreted by compiler. Okay, so this is the place where you can give at the shoma information about your program because normally, if you did something like that, for example, this is a public law us A secrecy. The compiler is trying to interpret this thing all these tax here. But if you do it that way, we just one line comment. You can do it pretty easy, right? You can comment your coat. So why would you want to come and your coat? Why spend your time doing it? Well, because we are people and people forgets thinks like right, we are just human. So we are not perfect. And because of it, after you ride your programs and when you come back to your programs after even one month no, one year to year or three years, even after one month when you come back to your program, you know, gonna almost remember anything about it, Really? So that's why people are commenting things. And that's not the only reason. The second reason is that you can. We work in team, right? You can work work with many people at once, and they will not understand your coat instantly. But with comments, it's gonna speed up the development process of your program off your perfect application. Big application, right? That's why it is really very, very important to commandeer coat. So there are two types of Commons one line comment, which allows you to comment here, as you can see. But when you could enter you cannot it see animal common, right? It's not gonna on comment this here, and the more you want to have multi line comment well, you can do, of course, something like that. But, you know, we do take lots of time if you want. If you wanted, then delete something right from middle, for example, like that black you can use something will discover multi line comment. You just type slash than the mastery sign sign. And then you can type comment right on this. Considers editor. Automatic carry automatically changed on that Well inserted here. Ah, this science. Right. So now you can have multi line comment like that. You have probably noticed that that generated comments that are here have good additional asterisk. Well, you don't need them here. They are just here, so it looks better. But there is a small difference between this and this. If you start it come in like that, it's gonna be later used for the Java documentation. Okay, there is a program called Java Doc. We just generate a documentation, so there's a pretty big difference here. We gonna have a special lesson where I'm gonna teach you how to create properly comments. But, you know, we cannot do it right now because we don't know what it's class with. Our arguments have to send them whether functions other things like that, we gonna I'm gonna show you everything like that in future lessons. For now, you just need to remember that you should create your habit, a habit to come and your coat know everything but things that are just a bit harder. Okay. It's good idea. Did comment your coat Because it's gonna save you lots of time, not only for you, but also for your future team. Okay, there's only good lesson. Thank you very much.
7. Basics: Hello Today we'll talk about basics in programming in Java. Language. Well, the first thing I would like to tell you is that when we remove Colman's we have got here something will discord y spaces. White bases are enters Taba. Laters spaces. And, well, they're not interpreted. As you can see, I can play it. Well, I can have everything in one line. Look what we can do it even like that bomb bomb on bomb. Everything is in one line, right? It doesn't matter for the compiler, it is a computer, right? It is just gonna interpret everything like it's, you know, formatted well, but you should form of everything pretty well, and you should do it the way that I will do it in the future lessons. Okay, If you follow how I format things, your code will be read able not only for you, but for other people. And this is very important to I understand, right? So, for example, instead of writing a plus B, you can write a space blast space be It's gonna be easier to read. And well, I'm talking about these wide spaces because well, you need to know that what we can write everything in one line because off things like, for example, semi colons, You have to remember that after every instruction you have toe ended with the semi colon, every instruction is a common toe. Your computer, What is a common? Well, a coma instruction is just forcing your computer to do something. So when you write something like that, you say, Hey, I want to include a package called Basics We just here. If we had more fights here, it would mean that you could use all informations from other fights like that inside here. Right? So that's why you have got the package named Basics here and well, right now you know what is package right? You can include other packages from other people on that were created by other people on Did you can use then thinks from there. And what are these things from there where they are classes here is a class created automatically by our net means, right? This is the main class. It is public with this public weight. Well, it doesn't matter. It's just a modification. Er you just need to know that for now, it ah, the main class has to be public on the main cause. We were just You know, that class that has good the name magnify. Okay. And, well, what is a classy might be Wondering. Also, a class is just an container, a container for things like properties which are gonna describe something like, for example, a window. We have got the window, he right, And these window has good work with Hi. And you can do things with that life. For example, close it and you can, for example, maximize it. Neymar's it, right? You can do thinks with the window and things like that are gonna be described inside the club so we could create a class. We work a window and inside of it would have properties like waves like high. And we could create a function which is something like that that could allow you to close it open. And as you can see, here is a matter which is oclock, which is a function, really. So this is similar name, right method function, and it's called main. And the reason this function is here that it has toe execute all instructions that are inside of it. After invoking that main function is very special because it's gonna automatically be executed after creaking here place. So we would create an instruction here. So, for example, system, which is a class somewhere. And when you get to something with this out, which means that we want to get out something from the system, right? And we want to print something. For example, attacks life example, sample text. This thing after clicking play is gonna be printed here, as you can see, So these function is gonna execute other functions, other instructions. As you can see, we have a tour, a semi colon, because this is an instruction, right? You have also probably noticed that here we have a good carol Abrasives, Kerry braces say where? Well, you have to say where there class is starting. Right? So the basic class start from here and ants here, right? You don't use semi column for it because, well, you have semi column here. Still, the compiler wouldn't know. Well, I decepticon is for for for what? For these crowds or maybe something else. Right. So that's why we have good care of the braces. And method also needs to know where it has to start and where it has to end. So here we invoked. So it means that we what we use somebody called that this start inside the print function and this print function is, as you can see, after kicking place showing something here, and we're going to create our own functions in food future lessons, you're gonna learn lots of functions from libraries that are gonna help you, for example, create a window like that one or, you know, calculates something. Cup. So this is the reason off creating functions and that's how you use them. These the basic functions that we're gonna use in the future Lesson. Keep in mind that this is a very, very fast introduction, and you don't need to worry if you don't understand that. Well, what is that strength in? What is that? Think here like that. What is vote with this study? Good is public. Why you didn't tell me about this? Doesn't matter. For now, you just need to know that this cult is gonna be invoked first. Okay? And later we go. Not. I'm gonna introduce to you something like vory bulls than alright, then We're gonna go to the functions, matters and other things like that. Why do we have modifications like that? That what are exactly classes? How to create them? How toe, you know, connect it. Medical, many classes to each other, other things like that, right? For now, we want to know that Main Functions is a special function that is gonna be invoked as a first function. And it's gonna invoke all possible instructions between discovery braces and this curly brace. Okay? And we gonna learn the syntax of Java in future lessons. That's forward for now. Thank you very much.
8. Shortcuts: Hello. Welcome In their balance section, where I will show the most useful short cover. It's gonna save you lots off time When you gonna develop programs, your own programs. Why? Because you know, using your mouth is just a bit slow when you have to say things off, for example, five. And then do they go to the safe here? It just takes someone you to copy something. So when you do things like that, mouse is just always slower. And you have to remember that you gonna spend lots off time writing code as a programmer. Which means that E knowing all these short cuts is gonna save you time each day. And when you multiply it by the days that you're gonna program is gonna save you lots off days off your very precious life. Okay, so let's start from this first shortcut control plus s from, as is from safe. And it's just saving the fight you have. You will notice that when I change anything in the program that you have got here a bolt bold it fine. And I hope I'm automatically saving, always using the counter process. Why? Because well, when, for example, I would lose the power, right? I would lose all my work. Right? Some editors. Can you get back to the place where you have lost your power? But some doesn't. And this is the universal Ah, shortcut. You can using an editor. So it's very important to know the next one is used for toe copy things. Well, you know, it's slow to company things like that. Balm on Go. Oh, here is a copy and then enter here and paste. It takes lots of time. You can just use control Potsie than control plus V And this you consume can copy. And as you can see now, when I didn't want to have a change like that, I can go back. Using the Contra Palazzi days is very cool shortcut because it allows you to go back when you did something to your Cody. Didn't want to do right. It's very, very useful. These did well and but sometimes you might think it a bit too many times and you can use the country plus why it will redo the action. Okay, so you can go back to the place where you started going back and whether you have. You can also cut something so you can you know you don't You can copy, but in the same time, cab, the thing that you want to copy from the place of for example, remove it from here and ties it here. Right? Okay, let's go back to that, uh, origin or fight. And let's now find out what is the counterpart? F shock. When I use the counterparts F as you can see now, I can search for things inside our products so I can fight, for example, main function. I confined. For example, Where is the public key world? Where is the package or other things like that? I can instantly find things on. It. Really has you a lot. Almost. An editor has good. Something like that, even in the Web. Brother, when you're browsing for something, it's very important because you're gonna browse for two to learn about libraries for Java, for example, and you want to find something specific about Java. You can just use the contra plus F in the Web browser, and you can find it faster. Okay, so it's very useful Shortcut control, plus a which sends for all, and you can just select all things from your from your well program. Why? Something like that is needed. For example, you can just do something like that. Now they control plus C and you can paste the code from here to, for example, a place where you going? Toe. Ask somebody. Why doesn't war, right? You can come from Passaic Controversy counter plus food V somewhere else. So it's very useful control plus back space. Sometimes it's gonna happen that you want toe deal it something like, for example, award to write. The truth is that you want to, for example, remove a variable but we'll talk about a very poor state. And if the name of a rebel is long Oh, so you need to do something like actually basically sleep exit right. But you can also do things like counterpart class backspace And as you can see now you delete full work at once. So it's also cool and this thing is also very useful. It is top and chief, plus stop thes one. You probably know, but this +10 this is very useful. And many people doesn't know that you want. You can go back with your indent, right? Would. I mean, let's create a variable in. And that's a sign here for we'll talk about later, things like that. But you know, physical and we are checking if a is equal to four. If yes, then I want to pray into the output ball or something like that. And well, as you can see, we have go to an Indian and sometimes you might have a problem. So, for example, you you have a cold like that. Oh, it's not looking good, right? You can go back using the shift, plus stop it. You can see you can go back using something like that. And the cool thing is also that you can use the top toe move manner as you can see things at once, and you can go back also. And well, waters, you have got here also, something called is called and and home on your keyboard. When you're for example here and you creek home, we are at the beginning of the line when you and your at the end of the night and when you I want to, for example, copy something like that, you can do something like shift plus home and, as you can see now have got selected line. And now we can use the counter policy and now concretely and and then enter. And as you can see now, you can copy it pretty easy. Was more You can use the shift and the arrow keys to select more than one online. You can also use the left and right arrow key to select specific. You know, as you can see, um, character and then you can copy writes a country plus seconds plus V on bom bom bom bom bom bom bom. As you can see, it really improves the speed off cop eyeing things on your in your prose. Of course, I'm doing things like that very far. Right now. It might be new to new things to you, so just train. You just need to train. And finally, you're gonna know all these shortcuts pretty well. You have got all them all described. You can print them so you know, just drink and you have got also something Go Discuss control plus home, which allows you to jump from the place where you have got your cars are okay so you can jump from here to the home, off your program and to the end. It's very useful because it can. Sometimes you want to go to the top of the off the program, and it's also useful because you can use the shift plus and a ship council plus. And and, as you can see now you are selecting with using something like that, right contra plus shiftless and allows you to select from the place from the course. Of course, a place and home life it There is also very important shortcut for these editor. When you take, for example, stuff like system, then you click a dot that you can see you have got you a man manikins, right, But sometimes you can lose them. You can do something like that, and you want to somehow get them back. You don't need to delete the dot in order to see the game. You can also do something contra plus space, as you can see. Then you get get Sheen's like that, so it's very useful to get him. You can also use the control plus space to, for example, create a coat like, for example, I look for as you can see, then you can just change things here. And you have just created a pretty because this is called a snippet drive. You can create a sniper's like that, using the control plus space. And I want to check if something is true or not. So this is pretty useful. A Z you can see wide Look, another things like that. Um Okay, so that's going to listen. Just trained it. Thank you very much.
9. Variables: Hello Today I will tell you whether we're Abel's. What is a type of a Rabel? What type off variables you can create so ever able is a container that you can use to store information data like, for example, numbers, characters, other things like that. So very booth are looking like that, right? A container that you can name and you can put something inside and well, the true vis that it looks more like that you have got a ram, which is random access memory. Yes, that's why you need rum. You want to reserve something from your random access memory, right? And when you do it, you can starter, for example, numbers, characters or floating numbers. So numbers like that and have to do it. How to give an instruction to your computer to reserve something from the random access memory. In order to do it, you type something like that in the main mattered and a for example. So I have just reserved in the random access and memory at place for numbers for in teachers. It stands for integer right, which is a number, and now I can stole their a number. How to a sign there a number. How to change the value there, Right? In order to do it, we talked that equal sign and then we say what you want to assign there. So, for example, 10. So right now we reserved in our random access memory because he's an integer integer is saving 30 free bits, which is four bites off your memory. So yeah, it would take for more bites. Your program will take former bite when you click play and well, you assigned her 10 right? This assigning is called initialization when you assign a volume two variable the first time so you can later off course change these value. Or of course, you can also send you to the airport using their for example system out print line. This shortcut life just used is when you typed the sea out on you kicked up, as you can see, then you don't need to type all this. Think again, because off the net beans, I d. So I just sent 10 on the outward. As you can see, it's working fine. And of course, you can change these value at the time so you can change it to for example. 50 on as you can see now it's 50. So that's how you change a value. Well, variables are called like that because they are able toe very, which means they can They are able to change right on. And we have just changed the value off. They're very able like here, which can start off course only in teachers, which are numbers. So, um, we have to remember to be careful to not set something like that, right, Because this is called string, which is sequins off characters. You kind of start characters inside different container that has got the wrong type. OK, so we need to learn about all possible types that we can use. So we wanted to start here something like, for example, string. We need to type string. Then, As you can see, we can easily start something like that. So, for example, my name, right? And of course, Aziz, you have provided noticed. I can't assigned to a string a number, right? You can change the value too, the different type volume. So, when I played as you can see, here is my name. You can of course, create and well, you should name in the big betters off example name and now my surname. Right on Now we can something like named plus starring Plus is used to connect to three things. And as you can see now it's our Kardashian for Dr. If you want to add the space, you're just gonna do something like that, right? Our country is for Dutch. It's just that it Ah, some space here, right? Using this quote signs. So that's a string we need to something in common that's created live as described Would we have just learned? So there are integer types like the end and it's 30 feet bides Let's go. Paid here from here and well, you can start there from minus two to the power off. 10 to 1 to to to the power of 31 minus one. Well, we could go into these a bit deeper. You just need to know that you can start values from that. Ryan arranged to another run. Tried. So when you do something like end A, you can on the same here or something like that, because they say, you know, this number is just two large. Okay? It's too big. You cannot do it. But hey, what if I wanted to assign here something? Because, you know, sometimes you want to do some scientific stuff. Then you gotta use for example, long, Long is 64 bits and you can start their numbers from minus two to 63 to the power of 60 feet too. Two to the power off, 63 minus one. And when you do stuff like that, as you can see now, it doesn't work still, but is because by default and the number looking like that is in teacher, if you want to change it to the long you need toe, do something like that. You need to type. But the n l let's do it with the big letter so we can see right and no when the get it to the output. As you can see, it's working. We did it that way. It's not gonna work if we need it. For example, that way it's also not gonna work. OK, so we need to add this l at the end to say that you know what you are doing. You want the big numbers here, okay. And well, what in the other in teacher types that we have. We have got some short like, for example, by which is a bit bite is really a bit so it's nothing surprising. Thing is the smallest amount off information you can start one beedies smallest information can store in your computer Which 01 right and, ah, the the ranch from is from minus 128 to 127. So you gonna use the bite when you don't want to start big numbers like that, you want to start just very small numbers. And you I don't want to used to march spacing your memory right. You're going to save your memory. You can also use the short integer with its 16 bits and you can start their from 32,078 miners 7 32,768 to 33,767. So something like that right on you can start the just beat bigger number between this thing. Okay, so these are in teacher types and now character types. You can use the character time to store a character. So example was carried the character and let's assign here a character like I and let's get it did output. And as you can see, we can see character. You can start on the one character. We're gonna do something like that, right? We want to do something like that. You have to use the string which can start sequence of characters and look at the difference Here. Here we have double quote right here. We have an apple stuff, but its single call. And well, if you want to create a stringing to use that one, you want to create a character single Carter, you have to use them apples through a single quote. Right? That's very important to know. So off course there is a string which can start many characters. All right, so the one that we have learned here like that there are two more types jaar cult floating numbers, which allows you to store numbers with a fraction. So, like, for example, that right, In order to do it, we should use the type that this called float double, so float. It's single procedure, which means you can lose precision here. Onda double these double precision, which means that it's better to use the princess this room is that right? Now, almost nobody is using the floor because it's mine. Give you more headaches. Good things. Okay, this is a good 30 fee. Book bits is 64 bits on these one can store 1.4 multiplied by 10 to the power of minus 44 5 So the fraction is very small. You can have fortified zeros right after the dot and to three point for multiplied by 10 to the power off 100 and 20 is 38. So it's very big number. And here is even bigger because you can start your 4.9 to the power off what minus 320 free . So it's very big on here, freak on there and that. But as I said, area to know these fault, Unless you want to server small number and you don't want to almost when the operation. Okay. And you really, really want to save the random access, more memory, which we have. Tom's off off the right hand right now. So big that we shouldn't most time care about something like that when you But if you do not need to do any preparation, need to store a number that is, You know, you don't that doesn't have many things after the dot. It's then. Well, yeah, you can use the float, but there is a small problem when you carry the float, for example. Number. Right? And you're saying here something like that, you notice that hey, he was something wrong. Have toe as it to float for the hell was going on. Um, when we do something like that, it's concede program is not working so flawed is not working at all. When we create a double its working for I'm fine, right? But double Well, any number that has good a fraction has good that is automatically adding here something like D D right, Which stands for double. Okay, now it working finest consisted for float. You need to trust us here, and f Why? Because, you know, some people could make this mistake to create float number, not knowing that it's single precision, and it can create for him problems that would be very hard to solve. Okay, so that's why instead of flowed, it's better to use just double okay, unless you don't do an operation on these numbers, it's also good to know that when you are creating vory bulls, you can create man at once. We can create something like end on. Do you can do something like C d E f g. Right further the problems. It's good idea toe at your spaces, so it looks a bit better. And, of course, you can initialize one off them for self, for example, like that. And it's gonna work fine. Off course. You cannot use the variable that is initialized, which means that it doesn't have have value. So you need toe to something like that. Okay, designing that lesson. Thank you very much.
10. Naming convetions: Hello. Today I will tell you about naming conventions for variables. I would tell you also what you should and void. So naming conventions means how you should name your variables. The first thing you should remember that you should net create a variable that should be said the script, which means that it should be like when you look at it, you know exactly instantly what it's gonna be useful. Okay, So when creating a were able and you call it a pet idea of course I use it in the last lesson. But it was just do fellow you how to create a variable. But you should avoid situations like that. Your were able should be said that script. So if you are creating a string that we will star names, you should call it name. Okay, It's gonna store starting. Call it Starling. So surname our cop. The second thing you need to know is that there size of letter or future terror matters. So if I want to change these name, I shouldn't type something like, for example, that because it is not gonna work. As you can see, it's not working because these vary but it is not the same as these words, right? These something like that. I'm just gonna create another variable, right? With just starting letter, which is big. And you should also remember that you shouldn't start name off variables with big letters Because these a convention variables should always start from the small case on. Then if you want toe, have you know something like name and signing, for example. Right? And you should be deadly. You should, for each word, try to have the upper case off letter. OK, so now it's you can instantly. Hey, it's name and a salmon instantly. Right? Oh, okay. Because if you call it a you don't know what this start here Exactly. You have to look at the value. Okay, Maybe these values very easy, but maybe these values sent from from the fire and you don't know exactly what it's gonna be right. So always try to name everything to be said the script and what you should know that you cannot create as the name over able as the label off. Vory bull, you cannot use keywords, which means that you cannot do something like that in public as you can see. It's just not working right. You cannot use things that are reserved. Why? Because you know, interpreter is just going well nine by time and line and is trying to compile it. How can Kinky complied when when he knows that started means something totally different, right? Uh, it's not gonna work. The second thing is that you shouldn't start creating a variable from the number, so you cannot do something like that that's going to see it's not working. You can have numbers inside. Like, for example, here here doesn't matter. But you cannot start from the number because, you know, then compiler things done that you're creating a number, not a very And the terrible thing is that you cannot do spaces so you can do something like that. Of course. Right, because, well, it's another work. There is a so one more convention that you should know when you're creating have a rabel that is constant, which means its final it's gonna be changed it like, for example, P number p. So, for example, in create being like that, I am gonna use, as you can see big letters, because it is not gonna ever train Friday is always free point for So when you're looking in your program, then you know which variables are constant final and which are which cannot be changed. And you can even say exactly Hey, I don't want these very will be changed and you type them final before it goes of it. When you do something like, for example, trying to change it, you can see you have a good an arrow. We have the final here because you can change pretty easy these without the final modification. So because just lentils with our motive IQ a tres they can modify how the variable is gonna working in program the final Leave it like that. And well, it's good idea that if you had more than one word in the final variable to do something like that, for example, number dash be okay. You're not because you're not gonna lose your hearing. For example, small case letter. You just we want to give that space there. You should used underscore because this is an read a book. This is readable pretty OK on. But that's that's how you should create variables. How you should name it. Remember self descriptive paraders are very important in order to make your coat clear and easy to maintain that telling the lesson. Thank you very much.
11. Casting: Hello Today. I will tell you what this casting casting It means changing a type of a Rabel into another type of a Rabel, and it is used in situation like I will show you soon. For example, when they create assistant outpouring line method and I do something like one divided by five, you probably think that he will have, as a result 0.2. But the result is zero. And when we do something like, for example, for Hey, it's closer to five. It should be one, right? No, it's easier. But well, if you don't five divided by five, then it's one. If you don't eight divided by five, it's one. If you do 11 it's too. Which means that the result off division off to in teachers is always an intention, right? We just take the fraction away and just throw it to being right. It's gonna be deleted. But, hey, I sometimes have situation like that, eh? Divided by being and I don't want as a result to hear. I want here 2.5 how to do it. Do I need to change the type of are able? No, you don't need to you can some times want situation like that, and then you cannot do it that way. You're gonna use casting If you want to cast a type of arrival into another type of a Rabel , you gonna type the parent is is than the type of Arabia we want to casto. Then the next parent is, is and the name of a rebel. You want to cast to another type. So right now you want to change the integer to double And if one off the variable iss double, it's enough todo the results So the result becomes, as you can see also double Okay, So if I did something like that see, divided by the it's gonna give us a za result off course 0.8 If I'd do see by being it's also gonna give us the as a result, the double. So that's how you use, you know, casting. But let's see eating other situations. So, for example, let's create a result unless it's something like that. A divided by B on double results too see divided by the and let's get it to the output. As you can see, the result is still of course, because five divided by two, it's 2.5. But the result is what integer Andi. Now imagine a situation you want to divide A by the way, you want to divide to different type of Arabe als. Well, you have probably noticed that we could do it that way right here it's gonna wear. But here's something is not working fine. Why? Because Well, he we just printed it out. But here in the line 11 we want to assign the result old into the ah variable called result . That type is end, right? We want to assign double into end and it's not possible. So you have to change the result into the integer. You have to say the compiler you want and you know what you are doing because you know here , as you can see, size incompatible types possible loss of conversion from double to end. So it means that hey, you can make make some problems here. I want to make sure that you are doing everything fine. So you have to use the casting right, but not to double but in teacher, because you want to change the day into their integer. So you have got the integer divided by integers of the result is in teacher and now everything works fine, Right, Because five divided by 15 0 upon free, free, free, free, free. But you gonna throw away the fraction That's how it should work because this is a, um, division off to in teachers. Okay. Ah, let's see what would happen if we did something like that See, divided by s So we want to divide toe maybe see divided by Oh yeah 12 Divided by five It's shoot. Give us the result. As you can see, 2.4, it's double because well, doubled by integer is double Okay, so you can assign double to double right? So everything works Fine. But if you want to see as a result here, for example, on Lian Teacher you could do just something like that. Hey, I won't hear a name teacher on this. You can see now we have got here too, right? We couldn't change it and the second to another time doing something like that. You also need to know that sometimes you can do things like that And as you can see, the result is wrong. So if you want to fast change the result to the right result, you need to change one of the type to the double right using the casting. But you can do it a bit faster. Way you can do just something like, for example, that 1.0 why it's gonna work is that because this is the two double type, the value off double unity is the point. But hey, you are so you're thinking like, right now in line eight, you're not using something like that. That's true. But in the background, the compiler is gonna change the integer into double here. Okay, It's because double has bigger precision and that's why it's gonna work, right? But as you can see, for example, if you do something like that, it's not gonna work because, you know, double cannot be stored inside an integer because double has good big gulp. Recisions can be a big number, and it has got lots of more buys and other things like that. You cannot do things like that. We've out exactly saying I want to change this into the indigent. I want to lose everything from you know, after the dot, right? You want to lose the fraction. That way it will be okay. So that is casting and the There was another thing. Another place. Where you gonna use it? It's gonna be used when we we cannot talk about polymorphous, but it's gonna be in the future lessons when gonna talk about object oriented programming for now, it should be enough for you. That something good lesson. Thank you very much.
12. Arithmetic operators: hello today. I would tell you what our operators and we'll talk about arithmetic operators. So operator is, as the name suggests, and operators of something that is operating on something in our situation, it's gonna operate on variable. So it's gonna do some actions on variables, and in this lesson, we'll learn about arithmetic operators. So, for example, plus miners mastery sign and the Baxter sign. As you can see, they are useful adding force, obstruction, multiplying and dividing. These are pretty easy one, so we'll focus on a bit harder one. Okay, so these only you just used by, you know, typing on the left side, one of arrive on the right side, done other wearable. And it's the same I give you didn't on math lessons. These are the basic operations. It's 100% that you know them. So let's focus on things like here when we have got the variable. So, for example, in A and I assigned to 552 years and we send it to the outward. As you can see, we have got five. What would happen if I wanted to increase the value inside that variable? A. By, for example, free what to do, where I need to do something like that. A assigned to a A plus free. So we are assigning here the value that was in a before So five. And now we're adding freeze of five plus three is eight. And because of it, as you can see, we have got at him. So in order to change the value without losing the last value, you have to just Assane the value that was there in the first place. You might be like about Hey, how does he know that here is five. The new value? Well, the instruction is gonna be always executed from the right to left. So first we're going to add five plus free, and then we assign the some of it to Hey, so as you can see, that's how you do it. But well, it takes a bit off space. And you know, every programming is programmer is a lazy person, but in the intelligent way so you can do Stipe something like that. As you can see, it's working also on Well, let's do this one. As you can see, we have got here eight. So we are plus five plus free is right. So these a short cut for doing something like that. Okay. Off course. You can also use it to do other things. Like, for example, let's remove. But let's subtract from this, for example to so we have free. As the result, you can see the result is free. You can, of course, multiply so we'll have five multiply biter. So it's stand five multiplied while divided by, for example, free. As you can see, it's one. Why? Because five divided by three is y 1.66666 And this is an integer Opara operation, right, Because there's an integer type. The result is also integer if we change it to double here off course, the result is having the fraction, right. Okay, so that's how use the shortcuts and use them because, well, these are very often used operations, so it's very useful toe know about them. You will surely meet something like that in your adventure when you're gonna program and well, you can also use something like incrimination and decriminalization. Implementation and dick lamentation allows you to fast at one or two the value to the original value or D cram in the original value by one. Okay, so for example, we could do something like that that a plus plus and as you can see, when we executed, we have got here now, six because five plus one equals six. Right and off course, You could also write something like that and it is the same. But I you know, it's shelter. So you're even more lady here. This is the most frequent operation when you are doing anything with looks that we'll talk about, for example, in next lessons. So these use very often so they even more decrease the amount off characters you have to type in order to achieve something like that, right? So way are just decreasing the amount of characters we need to type doing things like that . Of course, you can also use the discrimination. But there is also one more problem here, something like post implementation and pre incrimination. Post implementation means that you are gonna increment after sending it to the output and bring commendation means that you want to send it to the output first, and with that value over the increased well, let's show you an example here. When we do it that way, it doesn't matter because we're not sending into the output in the same time where it matters is, for example, here when I do it here a plus. Plus, As you can see, we have good five here. But if we did something like that, you will notice that we have got five here, but then seeks. Why? Because Well, it is a post implementation, which means that we have toe firstly what show on the output five and then increase it by one. So it will be the value will be increased by one. But you will be able to see it on Lee later. After after these well instruction here, right. If you want to change the behavior like that, you just need to take something like that. So as you can see now we have got your six. And here is also six. Um, of course, the D Crimen rotation also works the same. So as you can see like that, when you do it that way, you would notice that we have got five Firstly, because we are doing post documentation, which means that we want to first send it sent the value of our able to the output. And there is also something goddess called the moat operator. The Reminder off division Operator, this is one of the coolers operators because it gives you the remainder off the division. It gives you the fraction. Right? Um, what is what is rest off the division? Let's see. For example, let's do something like five mult. One more five. What do you happen? What will be the result of this? As you can see, it's one. Why? Because one more five is Jaws one ah, divided by five. So it's like something like, we just take this place here, right? When we do something like that, you would notice that you have got to do we just take the fraction right? But what happens when we get here? Six. As you can see, we're good. Still one. Why? Because six divided by five equals one and one one divided by five. Right, So we are taking just these place from here on. Well, if we do something like that, it will give us, as a result zero. Why it zero Because five divided by five is 1.0. There is nothing after the dot right? So, uh, you might be like ahead by a body Say that it's very cool White. So cool, Because imagine a situation when you want to do something after each free rounds. So, for example, if somebody click on bottom three times, I want to show something special. If he doesn't, I don't want so how to do something like that. Well, look, when somebody click first time we could increase, um, values of, for example, of a rival, right? Could this sign? I hear and we could decide like that. I malt free and as you can see it zero. So it is the first time and then we could increase the eye so we could do something like dead weight. I plus Plus Ondas you can see now it's then one a gang. It's too. And then when somebody clicks the third time, as you can see it, zero king, because Fremont's tree is zero. And then again, when we do the same thing as you can see is one. So every three times it's got this result is gonna be equal toe zero so we can use this information we can do something like the conditional statement that we'll talk about later . We could do something like if there expression like that equals to Obama zero, then we can do something on Well, things like that. We're doing future lessons. That right. But this is very useful for situations like that. When you want to do something when you want toe involve special instructions after somebody . Somebody, for example, creaks the bottom three times. Right? When, for example, you want Teoh have each tear draw being cold or something like that. You don't want to have all of them, but oh, but you want to print to the output. Many rows body want tohave only color that all each each had one Right? Then you could use something like the model operator. Okay, there's only the lesson. Thank you very much.
13. Relational Operators: Hello Today we're going to talk about relational operators, which are most time called comparision operators. Well, there could comparision operators, because when you are relating to something, you want to see how things two things relate to each other. Relations. Are you a connection between two people, right, and you want to compare how they relate to each other, and in our situation, you want to compare how variable? For example, I compares toe for able be so you want to check if they are equal if one of the very bodies , for example, greater than the other. Or maybe it's lower, right? So how to do? Well, let's greet of arrival, for example, for example, a. And let us thank you five. And that's great. Very Bill Bay and leads the psyche, for example. Seven. And I want to check if they are equal how to do it. Well, then you just need to use the compa reason operator, which looks like that it compares a two variables and checks. If very booth are equal and you might be like, Hey, but I can see here that they are not equally. Why do you even pulled her checking you. Well, you can see it, right? The program doesn't that the first thing? The second thing is that you don't know most time would values of your variables have, For example, you can create a form where somebody can put things there, right? You don't know what numbers will be there, For example, The numbers can come from database. They can come from the file. They can come from the android application. Other than that, many examples like that. So right now we don't know how to do other things like that. So we're doing just basic things like that so you can compare, right? So let's do something like see out and ah, system out front line. And let's compare a to, for example, be. And as you can see, we have got here now something. Think force words that why do you see here? False? Because five is not equal to seven. Right? If I had here five and here five you're not is that we have got here truth. And now we have just discovered a new type of Arabia. We just go bowling, OK? So we can create a very able to discover bowling and we can call it what everyone. So, for example, is, for example, to and we can assign here, for example, I equals being right like that and do something like that. As you can see, it's the same so you can save to the bowling type on the true or force so you can save your faults. As you can see, it's working. You can say few, too. It's also gonna work, but you cannot decide here and other value so you can hear inside. Five. You can thank me 10 It's I'm showing it now because if you had program another language language, these things would mean something. In this language, you can only thank you true or only sign false. Okay, so, um, that is the bowline. And that's how comparision off to variable work. But you need to remember, and it's very important that this operator is used for what? For checking if two variables are equal. But these operator, where you have got only one equal sign, is usedto a sign right. This is very important because some people make a mistake like they try to, you know, instead, off comparing the assigned by mystical in the math. When you compare feelings, you're just comparing using the one thing. Okay, that That's why some people have a problem like that. So I am just, you know, telling you it now and taking so much time just because so you would not make a mistake like that. Okay, so this is Ah, this is that. And you might be also asking yourself Hey, why do even bother using it, doing something like that? Well, in the future lessons, you will find out that there is something good is called conditional statement. You will be able to do something like if and then you can, for example, use something like if, for example, a equals B then I can prick print something like test right? And you're not is that we can see test here if we change the values, for example, like that we're not, is that nothing happened, right? These a conditional statement. You can check if something equals to something and you can decide what to do. That's why relation operators are We talk about conditional statements more in next messis and well, let's talk about other relational operators. You have good relation, Operator like that which just checks. If two variables are no equal to each other, you have got also something like greater done right are equal to So if you do something like that, five is not bigger. Done. Seven. Right Ondas You can see we have got here Falls Onda. Well, if we change it to five, as you can see, we have got fescue always working fine. Of course you can use the single corrected like that. It's checked. If something is greater than so something, something goes right. So it would have something like that. It's gonna return Teoh here. That's why we have got you a test on if we do something like that while five is not greater than five so we will not see a test. And of course, less than and less than or equal, they work the same. So you can just train a bit and do research on your own home. Dis operator here. Okay, that's going Good lesson. Thank you very much.
14. Logical Operators: hello today Are we introduce you the concert off? Logical operators. Logical operators are gonna operate on logical values, weather, logical values, logical values is to or false. So these are the values that we learned about in the last lesson, right? They can be stored in the bowling type off. Vory So it's gonna work on through and forces. But before we gonna learn them, I would like to show you why do we even need Let's create a variable. So, for example, a and landed sign to eat five. Let's create a very able being unless assigned to it. For example seven. And we learned that we can use something with this called conditional statements to compare something right, Right. So we could do something if and then if a equals to be, then we can show to the output for example, to right now it's not equal. Let's change it. It's gonna vehicle. And as you can see, we can see here it's true, right? But what will Kappen Eve, You have one more variable here. So for example, see, And it would be seven and I wanted to check if a equals Toby And in the same time, I want to check if the sea is greater than B. Then what? Then we need to know logical operators. But the situation is for you, very theoretical. So you might be Hey, it's not something that makes me think that these operators are gonna be important. They will be very important because logical operators can be used in situation. For example, like that, when you have a desktop application, you can have a form in there, right? And imagine that you have good now a string, for example, part thwart. And here is possible to somebody, right then another string, for example, repeated password. And, you know, we can see if that guy repeated the password the good way so we could compare if password equals rape it possible. And for example, if is a terrorist off condition checked and we could save you through or forthright, we could now check using the logical operation operators that we cannot talk about soon. If the password is the same as the repeated possible and in the same time somebody check that terms of condition. If not, then we just not allow him to do something right. If I didn't register and things like that. So it's just up to you what would happen then, using the conditional statement. But in order to do something like that, you have to know logical operators. Otherwise, it will need to check everything in another conditional statement. Do take lots of time. It would be just horrible. And while you can use logical operators to, for example, change, check the range off, um, range off numbers, but well, let's go into logical operators. So we think and final ISI would our day Well, the first logical operator, the easiest one is the exclamation mark sign, which is the negation off operation. It is like saying no. Okay, so was this something like, see out on Let's do something like to. As you can see, we have to heal. But if you do something like that, we just changed through two falls. So to it's gonna be false. False is gonna be true. And it issues most time in situation like that East times off condition check. So we could decide like Eve not checked. Then do something like Bob above, up, right. That's just up to you. What you would do that For now, we just know that we can just bring something. There's nothing good about that's how we do it, okay? And the next cool one is the conjunction and use the to upper sent science in order to to use it. So conjunction is represented by the end. What, and it means that you need to have both expressions two at the same time. Well, this expression expression is just something like that, right? If it's a it goes to but being okay, it's equal to bay something. It's too, and now we can, and in the same time see is, for example, greater than five so greater than a where. Whatever Lett's just like you fight yeah, is greater because seven is greater than four. So we're gonna see test you. So contraction allows you to connect. Write two expressions. That's the first thing. But when it will return fourth or it will tend to, well, conjunction. It is true only if both expressions are true in the same time, because it's the world and right, If you say something like that, well, I am going to go to the cinema tomorrow and I will buy popcorn. It means that you are telling that you would do both things right? You're not gonna do go only to this, you know, Are you are gonna on by Popkin gonna do both things. So you have expression one. Let's create a table and expression to and the result off the that. So if you have, for example true and to it's gonna return to If you have to and Falls is gonna return false falls into it's gonna return falls and False and Falls is gonna return fault So it's on Lee too, when both expressions are too So let's write it up So come junction It's too only if both expressions are two in the same time. Okay, And you have got also something good is called alternative and use these signs him and well , you use the word or sometimes what most time it's called thes junction But I think the alternative is a better word for it because it gives you alternative option when you have expressed that whether it's cooking because I don't like to write the results will be just different. Alternative Say's something like, Hey, I want to choose the alternative good option and imagine that good option is to option False means that almost something is just working. But so if I have a good option to choose and another good option to choose, which is one of them, so the result will be true. If I have a good option and that adoption, I just choose the good one, right? I don't need to choose the bed. One bad option. Adoption, Bad option. Bed optional. No, I don't have anything to choose. So I will have to choose one of them. And it's false. Done right. Okay, so these junction, it's falls on when both expressions are falls in the same time that there's a different beating. Conjunction and disjunction, right In this situation, both need to be false in order to make it false in this situation, in order to make it true, you have to have both expressions too. So we use that alternative here. You will not. Is that well? It is five equal to five. Yes, then well, you don't need to check the other Paride because five physical toe five, it's frozen. It doesn't matter what we've happened here. If it's even false, it's gonna execute the in section here sequence. But if you make both expressions faults so it's a nautical, Toby. Okay, so we can say that it's false, this expression and if sees greater than for always greater Some We have to increase it, for example, here to five. So it's see greater than 1907 He's not great into the night. Okay, so both are false in now. And because of it, we cannot see the taxi, right? That text it is no Visy boot. The, uh, condition is not As you can see. We can't say it, but if we change it even one off the expression to to balm it's working. So logical operators allows you to connect two expressions and because of it, you can do some at five events compa reasons, right? Okay. There's only good lesson. Thank you very much.
15. Bitwise Operators: Hello, my friend. Today I will introduce you. The bid wise operators beat wise operators, allows you to work with bits. Bit is the most basic information that your computer construct. It is zero or one. These are impulses that your computer electronic impulses that your computer is gonna interpret. Okay, there manage sequences of the 1010 1000 millions off off sequences and they are interpreted to everything that you can see. And you can work with the Zeron ones using Budweiser operators. Okay. And before we start learning them, I would like to tell you where you can use this knowledge. You can use big bites operators, for example, when you want to compress data when you want Teoh, do some data encryption when you want to work with colors when you want to communicate between ports and socket. So this is a topic about connection between computers. So if you are not interested in topics like that, you probably don't meet to know this too much. But if you're interested in topics like that, it is just a mask. Help. OK, but it's good idea this to know what's going on. You know, it is a good lesson to know how to do to see how some things are done in our computer. So the before we go into the binary code, which is zero and ones we have toe talk about our coat, which is which is decimal coat. When I have number 126. This is truly something like one multiplied by 10 to the power off to plus two multiplied by 10. Multiply to the power off one plus seeks multiplied by 10 to the power off zero. So, as you can see, here are the numbers from that from the decimal number. And here is then here is common in numbers are in our system that we're using Do you know can't. So it's then and as you can see here we have two while and zero which re President presents that position here These the first position. So here is zero. We're counting from zero. So 012 and it's gonna be the same for the binary code or another coat when you have a number. For example 1010 That's changing toe. The decimal number one multiplied by two because these Obayan Eriko to the power off 012 Free to the power of free because it's on the but four positions of Formula One is free plus zero multiplied by two to the power of to plus one multiplied by two to the power off . One plus zero more deployed by two to the power off zero and it equals still what one multiplied by two to the power of three is eight plus zero multiplied by anything is always zero So zero plus one multiplied by two to the part of one is still so it's 3 to 2 and zero multiplied by anything is zero. So when you look at this, it is stem. Um well, this is that tan when you would do something like, for example, anti Jer A. And you assign tent this integer you re reserve in our from a place started to bits and there are 28 zeros. And then there is 1010 Okay, that's how we work. And 10 ones. You of course I didn't count how many. So this is the number in the binary coat, and you might be like, Do we have to really do so much operations in order to can't this to this every time. You can really do it a bit faster. I will tell you how to do it. Look at this. Here here we have zero multiplied by two to the power of to when you have zero. The truth is that there is just zero because zero multiplied by and I think is always zero . So we can just or something like that. And here's something like that. Okay, so it's smaller, not right. And now you know that the one when one is multiplied by anything it is no trouble. It will not change the I think that happens. You're right. We did not change the results so you can look like that and this can see now It's pretty simpler player than the thing that we had before. So let's try in the beat when you have 111 on for example one. What is this number? The truth is that you can just think something like that here is start. One here is still to hear stood for here. Still a So these are numbers that you get the power off to. So it's 1 to 4 egg and then 16 years 32 64 128 156. And so And because we have got here always once, it means that the result off this is a 12 14 15 right on. And if we had something like 1001 it means that we have as a result walk here is start one and he restored a right. We do not care about the zero here. We just think about place, places that have good one here. So eight plus one is nine. So you can very Farsi world is under number like that. Okay, so now we know how the binary code is working. Now we need to learn how to use the bed wise operators. Finally, let's start from the bid wise And as you can probably notice, it looks very similar to the conjunction which had two characters like that instead of one . And it also is gonna work very similar because one is really true. Zero is false, but only off course for this operator. OK, so do not assume that true is in Java is one, because this totally different time. But it will be easier for us because we learned that table in last lesson and we said that the conjunction is too so twice. And it's true on the above expression. And in this time, if both, um above wants are the same. So we can do something like that that's sent to the output something like a in conjunction without maybe 10 in conjunction with, for example five. So here is Stan, right? Let's great fight night. So it's 0101 Here is one who is force of four plus what plus one is five. And when I do a conjunction, what will be the result? So while and zero in conjunction is zero because we don't have to. Once you zero and one gives a 01 and 0001 Give us here. So the result is here, right? If we had something like for example, not then but for example 11. So we had something like No, you have in here. The result is what one But you can see It's so it's long OK, but you might be now like really, where can I use something like that? This is looking like very unuseful things. Well, for example, let's imagine situation that you created some kind of form and people have their privileges and you can start privileges in something like that. 0001 00100100 and 1000 And imagine that this first, you know, if he's representing that, somebody can add it falls next one is for posting the sick. The 3rd 1 is responsible for, for example, deleting. And here you can, for example, um, bomb somebody, whatever. These are privileges and you cannot go. Go So on so long, right I did on. Then you can assign pretty easy in very small number to somebody that hey, you can do something like banning people deleting things and, for example, you can pause, but you can add It pulls so somebody can do this. This and this. Okay, And this number is equal toward Well, this number is equal. Teoh, Um, one plus for this 55 plus eight is 30. So if I do something like 13 and for example, one. So I am checking if he can add it as against to see the result is one right Let's check if you kick and post the post. He's really the number two. Right is the number one who is due. He's for reside. So if I do, starting with the conjunction off Paul's with you. Still you notice that we have zero. So this guy cannot cause anything so we can start many privileges in one small integer instead of manner. Variables. And we can then sec if he can. For example, if the person can pose by comparing something like that with something like that. Pretty coat, right? So this is just one off many usages. My think he's one of the most popular one. At least four people cool with not compressing do other things I did. Okay, so we have other So Budweiser working the same like the alternative logic, right? But with the pits. So let's change it here out to 19 and 13 with alter native off. So is what might be Let's use this number. So it was 11 and here we have got start five right, so 11 and five will give us what while and zero gives zero because we choose out the native option, which is one with here and one. It's also 11 and zero. It's 11 and one is one. So it's gonna be a you can see 15. You have this situation like that. So 11 1 in this situation, zero z and the yogis has zero, and the result is one to free plus 8 11 So that is the operator alternative, and you have good. Also something called the skulk sore, which I presented here it is exclusive, or and it differs from the normal or ain't that thank you. Normally, these would be true one and one would give you true right but the exclusive or says that it's equal exclusive right? You can have on the one option that you can choose. You can have two options you can choose and are good. This how you can remember so one and one is here. And as you can see, the result is stand. That's because one and zero gives you 00001 and zero g zero, but one and one gives you zero this time. So that's why, as the result, we have got that. So when can use, for example, So in a situation like that, sorry school, Because look, sore is gonna return. Always zero if both thinks are the same. So you can check for equality using, for example. So if anything is a bit different, is gonna return value that this different from zero. So there is one more two more operators free that allows you to move its the left. So, for example, if you type something like one and let's move, it's five. And let's move it to the right by one. As you can see, we have been took you? No, maybe to a visa to present your 10. We have about five years. So he would have, for example, number 10 right? And this number, when we do something like that, is gonna be moved to the right by one, everything is gonna be moved to the right by one. What does it mean? Well, these one with the here. Right. So we have something like 0101 because there are many zeros, right? I remind you. So this will be 010 woman, and it equals to what one plus for which is five. So the truth is that we divide it. This number by two Typing Q one. If we did something like that, you gonna divide it again by two. So here is how many times going to divide this number in this place to the power off to the power to to the power of to this time maybe two to the power free. How many times want toe divided right by two. So that's how we work. Of course, when we just times like that, you might be dead. But But why? It's still no. 2.5 five divided by two is stupid fight because these in teacher right there is no double number. So that's how it works. And right, left shift. So moving to the left side is gonna multiply it by two here is gonna multiplied, bite to end in a game by two. So it's gonna be 40. You're just moving everything to the left side. You could Also, something good is called bid wise. Negation on this is gonna change. So, for example, when you do something like that, as you can see, these number two minus 11 might be like what investigation is changing one's two zeros, So this zero becomes zero, and these zeros. I know one, but hey, look how many zeros we've had here before it. So we had so many years. And now they all want. And when the first bit is one, it will represent the negative number. Okay, That's why it looks like when you use the car lighter in the windows when you creek 10. Here. As you can see, here is our 101 And here man is years. And when you click, not as you can see, the 1st 1 is here. No one. And that's why we have got number. That is just not a positive number. Okay, that's only good lesson. Thank you very much.
16. Conditional Statements: Hello Today I will tell you about one of the most important topic in programming, which is called conditional statement. As the name suggests, conditional statement is the instruction a statement that allows you to condition things that happens in your program. So, for example, went in future, you will learn, for example, how to program and and growing applications. Somebody would put something to the phone, for example, his email address. And you want to check if the image others in the first input is the same as that repeated any others, right? You want to check if something is equal, right? So conditions are used in situations like that. You want to check what is inside a variable? Because, you know, right now we just know that you can create a variable and you can assign hear something and we already know words there. So it will be like hate. Do I really need to check it? Of course, there are many other situations. When you gonna use conditional statements, For example, you want to run some instruction as long as what s, for example, ever able will be equal to 10. Things like that are called loop So we're gonna talk about the usages in other lessons. Right now, let's focus how to use conditional statement. How toe make it work. So in order to do it, you type award. We just called. If so, it just checks if and then we say in the parent Is is what do you want to check? And here should be an expression. Expression is just something like that. For example, is five greater than seven? Okay. And this thing, as you know, returns true or false, right? It can return to our force. And if expression is true, then the instruction that is below this conditional statement is gonna be executed. So here we type instruction that is gonna be executed. If the expression is true, If it's false, then this instruction here is not gonna be executed at all. So let's check it out. If a is lower than be, then I want to see on the output. For example, A is lower than be. And as you can see, it's true. But if I change, he value to for example, 15 will not say this statement. Sometimes you want to check more things at once. For example, I want to check if hey is not lower than be If house If a is greater than being, then I want to put into the output. As you can see Now we have got here. A is greater than be so we can check all possible things that happens. But who? We didn't think about seven, right? Is seven equal to seven years. So it's not that condition. It's not dead condition and you can do again else if a equals B and then a print to the output A equals being. But you can also do something I didn't as autopilot else. If all other conditional statements were false, then the instruction here is gonna be run. Okay, so that's how you can make your conditional state and the big longer when you want to check more than one condition at once, right? If this is not happening that I want to check. Hey, maybe this is capping. Oh, maybe. Well, all these conditions were not bad. So I want to execute the instruction here. You can, of course, check here more instructions. Right? You could check here many, many more. But if you did something like that, off course then. And the instruction here, something us happened. Well, will not happen, all right, Because we just check all possible situation before, but in some situations, you might want toe do something like that. Okay, so let's leave it like that. I would like to also show you that you can have more than one variable. What? Well, you can use the logical operators here so you can do stuff like C equals Stan. Right? And you can do something. Like if a is lower than B and in the same time, see is greater than for example. Ah, 56 Then I want to see this. At the moment, this is through right on. And here seven is not lower than be So we'll see this message here. Something else happened. But if I use, for example, alternative, right? And we know that alternative, he's working like that, that you can choose that option that this to so CE is bigger than six. So the result off this expression will be true in a way. Right? So we'll see this message here here. What is not true? Because it is not lower than the but we could right here. What? Everyone, right vehicle? No. Crazy see is great. And then six, Whatever. The truth is that we are just learning how to do it on some Ah, theoretical example. Right. Okay, so that's how use conditional statement that during the lesson Thank you very much.
17. Curly Bracers: Hello. In the last lesson, I told you what our conditional statements. Now I will show you a problem that happens when you want to execute more than one instruction. If the condition is through when the condition is met. Right? What will happen if I do something like that here? As you can see, we have gotten error here. It's not working at all. Why? Because Onley one instruction is gonna be run if the condition is met. If you want to group more than one instruction and you want to make it to run like a one instruction, you have to use curly braces. Okay, When you do it that way, you say that the range starts here and ends here for this conditional statement in the line 19. As you can see now, everything works fine. So here is also arrange for dismasted. The here is arrange for this class. We don't know exactly what this function and cause right now, but as you can see, curly braces are used to say where something starts and where it ends, right? It also is gonna make some other things. Like for example, ah, when you create a variable here, as you can see. Um Well, for example, let's go it, Dean, Because you have got a B and C D here. It's not gonna be You are not gonna be able to use it, for example here. As you can see, it doesn't exist. You right? You cannot around this program minimal. Why? Because everywhere able after the curry brace, sir. And in current occur the bright sir, and is met is gonna be destroyed by something with this called garbage collector because it is not gonna be needed anymore. Okay, this is called local variables. We talk about things like that in Well, another lesson also. But well, this is the first glance into these top. So this is Carol Bright sir. And you also should know. So you do not make me sick because some people make a mistake like that. They want to execute, for example, something like that. Only if all conditions were not met and when they executed. As you can see, we can still see the message. He right message here is gonna execute always. Why? It's gonna execute, always even toe. This condition was met, right? Well, you need to remember that when this condition is met, all other conditions are not gonna be executed. Well, is because like that? Because the truth is that white spaces are not interpreted, right? You do remember that, Onley one instruction is gonna be run if you want to make sure that this instruction is gonna be executed on Lee when all instructions here are not. And well, when all conditional statements here are not met, then you have to remember about creating here a scope, right using the Carib risers, we want to group these instructions in tow. One instruction using these curry braces. Okay, that's going that lesson. Thank you very much.
18. Switch: Hello Today. I would tell you about conditional state, and we just called switch. Switch is used as the name suggests to switch between the values off there. I think that is gonna be sent to the switch. So you created variables. For example, A. And you're signing teat 50. And you created switch and you sender variable A. You can switch between cases. So for example, case 15. I want to then do something like sent to the output is equal to 50. And if there are on the other cases, So let's create other cases. 15 and still, for example, 100 150. So 150. And if it equals, start on a different value, then I want to send to the output is different. It's not 5100 150. And who can say a equals, for example? A right. Of course, this is very impractical example, but I just want to show you how switch is gonna work. So as you can see, everything got executed. So did I lie to you? No. Well, they're sweet is gonna execute everything after one of the case is met. So we have got here a value 50. So everything is gonna be execute after these case. So this this this and this. If I had, for example, 100 you would notice that only this instruction these instruction, these instruction would be executed. All right. Okay. When you go to 150 on the decent days, if you start total, it's something different. Only this. But if you had default here, notice that everything got executed in the way. So east switch even use able. Yes, it is because there is a special instruction which is called break. You can break toe. Totally the case. Well, you have to break it if you want to stop execution. Because, you know, here you don't have something like curly braces To show where the case starts and worried ends. Right. Well, this will not work. Okay? I'm here when you do it that way, it's still gonna execute everything after it Will everything on the Braghis met. So 50 and 100 was executed, right? Curry braces here is just not working like it should get would break the switch. Okay, You have to type the break instruction in order to make it work like that, but you might like. But it's something like that, you say. But yeah, you can do probably something like that. If a is equal to 50 and it's maybe 100 so so is like alter native right. If it's equal to 50 or it's equal to 100 then show that a is equal to 50 or 100 right? And then you can see that this thing got executed right? And well Ah, the case 150 wasn't executed, and default wasn't executed, right? You don't need to type here brag because, Well, it's the last instruction here. So this thing is not needed at this. If the default is at the end. But you might be wondering, Do you need the switch? If you can do really everything with the conditional statement that you learned about in the last lesson, you don't need it. The trove is that's rich is on the looking a bit better, right, because you have got everything shown. Case by case you can look at these and cold might be a bit easier to read. The truth is that I have almost never used it. This is you should just know it because some people might use it. So it's good idea to know the syntax, right? So you know how to read it, how to read the code written by other people. And it's also a good idea to know that you can't send the switch double because you can't compare doubles. Doubles are just, you know, have got bread precision, and it's very hard to compare something with fraction, right. You also cannot compare. Something good is called string because strings must be compared using something goddess called equals method. But we'll talk about this about this in the future lessons and well, you can compare characters. So if you wanted to compare characters, you could just type here something that right, using the apple stuff. And if the character was like a capitalized this thing will be run. As you can see, the case he was met. So everything is gonna be run until the break is met by the interpreter of this program. Right? Okay, let's changing. But integer. And here 15. That sounded lesson. Thank you very much.
19. Conditional Expression: have I told you that programmers are very lazy people, but an intelligent way at the DEA's lesson. Human notice how badly they're lazy. Okay, because let's imagine a situation like that. You want to check if there number is even for its all too right, so the even number can be divided by two, and the old number cannot be divided by two. In order to check it, we can use conventional state and right so we can create a variable like that in order to see if these variable is really ought. Or even we can do something like that. If X Model two equals zero, then it means that it is even because six multi 20 right, so it's even it's can be divided by to Otherwise we can put the output. It's out for able. As you can see, it's even when I change it to seven. For example, it's odd because seven months to is just one, so one is not equal to zero. So here we have got false and this thing will be executed here, right? Because condition here was not met. So this condition is gonna and but the instruction after this condition is gonna be executed. And now look, programmers are very realizes. They said you could write it dead way. Mm. If then, even otherwise and you can save it, for example, to is, even the Rabel and you can send to the output scared him. Now that's coming. It and this you can see. Oh, when you do it that way, it's even so. This construction is called conditional expression. When you have something very small to check right like this, you can use conditional expression, which looks like that first you type expression, then the think to execute if expression, it's too, and then after their column, the thing to execute. If expression is false, that's how you do it. Don't use it, of course, for something bigger just for things like that and on Lee. If you think what the truth is that it might be sometimes more read able. But sometimes when people to not know how it works and believe me, some even advanced performance, forget about it and they have to go to there website and look about what is these things here? So maybe it's even better to sometimes right more right But this you When you meet a call like that, you would understand how it works. Okay? There's only the lesson. Thank you very much.
20. Arrays: Hello, my friend. Today I will tell you what is an Ara Ara is a sequence off variables that are start next to each other. If you want to create more than one variable at once, that has good, the same type and they are connected to each other. Somehow. You want to use Harry? Why? Because Imagine a situation like that. I am telling you. Hey, create 50 variables that we store numbers. What you will do, You will decide like that in teacher then? Ah, variable one. But we're able to variable free very before Babul five. Okay, I'm just kidding. I'm not gonna go toe to do it 50 times, but now you can imagine this situation, right? And now imagine that I would study. We don't need 50. We need even more. We need 90. We need 10 thousands. Okay, That will just take forever. It would be hard to, you know, even check. World value is where and other things like that. That's why we have got something good is called an area. Because we can create using a syntax like that. And Ari So here is the name of a right. And here's a type of a right. And do you just need to add the square brackets like that? And now he created an area. Now it's empty. There is nothing there. You didn't reserve anything in the memory. If you want to reserve something in memory, you have to take something like that. All right, equals. And then you tied the keyword new, which says, Hey, I want to reserve in the ram in the random actors memory right space for the thing that I will type right now. So four integers and I want to say how many vintages I want toe reserved their, for example, on authority. Right? So we instantly created, like charity variables. That type is integer and we put them next to each other because they are next to each other because they are really 30 multiplied by 33 beats, right, because integer is 33 beats and it's multiply bar 30 and they are next to each other right in our memory. Because of it, you can access them very easy using something what is called index. So, in order to access, for example, the first variable right, the first value off the area you need to type something like name of all right and then use the square brackets and type zero. And as you can see, we have good as the result Here, zero every Tiguan. It is also zero. It's because the area right now has good default values for the integer. When you do not a sign, anything manually that is gonna be zeros. But of course, you can change these values. So, for example, you can type here 70. And now when you access this first value, as you can see, it's 70. You might be also asking years of hay, but you're using zero here. And it's not fair that you should use one. You should start counting from one. Well, yeah, we are counting from one, but in programming, you have to remember that. All right. Have to be counted from zero. Okay. From the euro, you're counting in Texas from zero in a rise. That's very important because many people make mistakes like it. So if you create an area like that, you really created free vory both. But the 1st 1 is at the index zero, then the 2nd 1 is that the index one and that her? The last one is that the index to Okay. So in order to access the second element, we type, for example, something like that. And the last alignment, something like that. And now, of course, we can access all these values doing something like that. As you can see, everything is working. Fine. But we have to. Also not is that you cannot access things that are out off, you know, reserved memory that we reserved in our in our rahm. So if we do something like that right now, we don't have an error. But when we play oh, now it's wrong. Right now we have got a net over here and we have good exception that something happened. We are Index is out of bones. Bounds exception, right? Something is wrong. You cannot access something that was not reserved by our program. Because you have to know that when you are running your program right, you are reserving memory for this program for over eyeballs for the program itself. And if you do something like that right like that, you want to act as a write off index free, which it was not reserved in the line 17. Then you are trying to act to something that could be reserved by another program. For example, the that means, for example, that recording to the dying, using whatever right? So that's why you cannot access things that are not reserved. Okay, in the random access moment in our room. That's why we need drama idol. I mean toe reserve. Eso a raise, as you can see, are very useful. You can instantly reserve lots off space in incident. There are other ways off, you know, declaring Gary, you can do you also that way because spaces are not interpreted. But the convention is that in at least Java you should treat them that way. But this is the thing that somebody some people do not know. You can also declare it dead way. But as I said, convention is to do the dead weight. And now, finally, you have probably noticed that we are getting We are starting to know what's going on in our program. Hey, here is a string and the type of the string is really well, the type of this variable here is really not only string, it has good this square brackets so it means that it is an array. So it means that here we can send from from example another program or, for example, from the council toe our program arguments right are extends for arguments. Of course, I could call it whatever I want. And it will be around because this is a name of honor right here. Right, But decreed arcs because, well, it's then self descriptive. And that's how all variables should be called. So here people can send many arguments that we can later use right we could this affect our X zero? If our zero equals Teoh open, then we can, for example, open something, right? That's how this thing works. And the cool thing is that because off it, because it looks like that you consent more than one right, that that's very, very cool. You can reserve Memoria as in normal variables, you can assign values to normal variables. In one line you can off course things like do that right. So you can do it in one night and everything is gonna work Fine. You can also initialize alright like that, for example, Let's go it our right to and you can assign values into airy instance. You can do something lying that and later we can access. For example, the first element, which is 124. So it's a Deposition zero like that. And as you can see, it's working fine looking with 124 here, right? This solution is rarely used because most time you do not know what would be inside a narrow. What values will be there because they are sent from, for example, database from the five from the forums under things like that? Okay, but it's good idea to know, because there can be situations where you want to initialize it in one line. Okay, because you don't know exact exactly how many things will be here. The cool thing about this solution is that you can adhere new things, and the size will increase automatically so well. There is also one more thing you can get using that dot length the length off the area. As you can see, it's 512 free for five, and it's very useful to know how many things were putting to an IRA because of a duking access. For example, last element of the area Because the last element is at the index in our situation with 01234 As you can see, the land fear is retiring. Five. So if we did it that way, we're gonna have a number four. And we can use this value as the index. Right? Like that. As you can see now we have good here, 55. And when I at you, any number right? And there is the last element here, we're still going to access the last element. Okay, that's only good lesson. Thank you very much.
21. Multidimensional Arrays: Hello Today I will tell you what are multi dimensional a rise. But before we go into multi dimensions, we need to think about what this a single dimension single dimension means that you go into one way. For example, you have got a role here, right? The horizontal row. And this is a single dimensional Eric. But when you want to add columns so when you do something like that, you are going to ways you go horizontal way and the vertical way right. And then you can create a two d game, for example chest right. You can then put, for example, some poems or another figure that exists in chess game. Of course, you would need to increase these by the column size with me to make make it fix right. But now you know what I'm talking about. These multi dimension. We have got horizontal vertical. If you wanted to create another dimension, it will go like to you. To the monitor, right? It will be free. Dimensional. That's how we have good objects. In real life, we see everything as it was in the three dimensional space. Right now, the indexes are gonna look a bit different here. We gonna have the number off row, and the second index is gonna re present. What is the number of column? Right. So here, we're gonna have one. He's gonna be dio but he's gonna be free. And here is gonna be what, um, won the game to free one to free on to make it a bit better The third way. Bum on dumb. Okay, so that's how that two dimensional area looks like and how to create it. Well, before we're doing something like that using the one square Barket now, we just used to square Barket you. We wanted to create three dimensional free 4567 Right, So these are two dimensional. All right? And now we call it, for example top. And now we initialize to it. We are reserving in our memory space. For what? For anti Jares and I want how many rows? 1234 So I type here for and how many columns I need one to free. So I type free. And now we created two dimensional art which we can change. So for example, we can do top off 2.1 on I want to change it to, for example, 99 then we can send you to the output as you can see the result. Isse 99 suddenly changed their value off this guy here. And remember again, I'm telling you that you have to count indexes from zero. That's why we type before even told you can see here that here is free because the first always you can see it's called the year zero. OK, remember about it because it's very, very important and you can initialize also multi dimensional, right? Also in one night you can do it, deadweight that two equals. And here it's the semi column and now you have to create rows. Each row should be inside. Carried a brace. Okay, so now you can say that I won't hear value like that, like that, like that. And if you want another row, you at you a coma and then carry brighter Bram uh, another, uh, on another like that. And now let's train a bit. Let's think about how to get to, for example, that guy that is killed So this is the last row, so we should type top off too, and the last row is 12 free for, but you have to come from zero. So it's free and in order to get to the second color, just gonna leave that one here because the first column is a D Index era and the second column is a index one that says, You can see we have good here now minus 50 feet. So that's how you create multi dimensional I rise. And as I said, you can create it to use it, for example, creating two dimensional games. So that's all in the lesson. Thank you very much.
22. Loops: Hello, my friend. Today I will tell you what our lips look is a solution. A solution that allows you to execute as many times as he won't instructions. Because they're within many times in your programming adventure when you want toe run instructions more than ones which are very similar to each other. OK, for example, as you can see, we have got here an area area off video courses. And the type of this area is strength. So we have got here for strings, right? And what and how would you do it if you wanted to print all this? Things stood out. What it would do something like that. They would get into that all right, and then type the index of her. You would come pick it three times, and then you would do something like that and you would executive Okay, it's fine. But now imagine that we have another coast, for example. Ganja. Yes, right. And when executed, we don't see it. So we have to change something in our coat. You have to remember that when you are writing a coat, your coat should be universal by universal. I mean, you shouldn't change your code when something changes in data, your coat should work dead way that it's gonna work anyway, even if somebody at something to the something new to data. OK, that's how you should always try to program your co. So when you look at the coat, you instantly concede that it's very similar. It on Lee differs by these numbers. Here's and this is the time when you should think Hey, I should use a lip. Okay, So how to create this loop? Well, in order to do it, you type wife. This is a wild lip and then you create parentis is and in parentheses you type the condition of love. So, for example, why I is lower than for example, five. Then I want to execute everything between these curly braces. Let's create this variable which is called isil. For example let's create an integer you have to assign here a value right? For example zero. You have to start from something because if you do know the sign anything, we don't know what's in it. So we assigned here zero, and we are going to run instruction between discourage brace, Sir, Until this thing here is to this condition is too. Okay, so is zero lower than five? Yes, so we can print something out. So let's bring for example, I outside. Let's play as you can see. Now we can see that. Oh, really? The zeros are not gonna end. Never. You have to stop this program. Why? Because zero is Are we always lower than five? So this lope is infinite id? Look, infinitive loop is happens when your condition is always through. So you have tow change, this value and the under to change it. You're gonna use the operator are athletico operator that looked like that? You're gonna increase I after each time by one using this instruction here. So when I executed this this time, as you can see that have gone on a 012 free for why? Well, let's check it out. Is zero lower than five? Yes. So let's bring zero outside and then increase zero Well increased the value inside the variable I by one. So right now in I we have good one is one lower than five. Yes. So let's bring out one. Then we increase it again. So it's to lower. Yes, Free four. And then it's five lower than five. No, it's equal to fight. So it's not gonna print five just going up in everything from 0 to 4. And hey, this is something Something is gonna work here with that thing here. Right? Let's go. Patina we had here number 01234 So we're just gonna delete the zero here and put here I and Bomb. We just printed all courses that are insight here. We can beat this. As you can see, we just painted it pretty cool, right? But as I said earlier, your coats should be universal by universal. I mean, when I add something new So for example, sauce, As you can see, it's not working. So you should now increase here to six this number. But you shouldn't called your coat like that that you should know that you will later change something. Your coat when you add a data. So in order to change it, we go now get from video courses length off this area, using the length variable that we can access using the's dot Right? We told we I told you about, and these properties variable here on and it's gonna return here right now. What? Want to free for 123456 Right. And yeah, now it's gonna print everything up, and now we can add something totally new. So, for example, Java android, right? And bomb. As you can see, we edited because this property and has got all the ways, the value that it's actually in in that our Alright, right? And that's the program. That's how you should create your programs in your future. Okay? They should be universal. Okay, so this is a wild Let's create now, do I? Look, you can create a look doing something like that. Do why? I is lower than video courses that length. Right? Well, let's come in this. And let's boot this inside. Uh, like that. And when he executed, as you can see, eat works the same. Well, you might be thinking that it is working the same, but the truth is that if you change you the I know for example, that number it's gonna execute. Anyway, we haven't hear a problem now because this big number we don't have value inside this area , right? You can act. We can't access an Arab with so big index. Because do I Lope is gonna execute this thing at least once, so the condition is checked at the end. Okay, but if we take this under the common and we uncommon this section, you would notice Did the program that this instructions between this curry braces We're not executed the door. Why? Because condition is check at the beginning. So this is the only difference between dough I and why? Look, I'm sorry, my friend, but then I'll have to give you an exercise. You have to train. So what you should do? No. Please create a program with an area that size will be, for example, eight. And I want you toe a sign values to this area. In that way, the father first value in at the index zero should be turned in 2030 40 50 60 70 80 90. Well, I stole. I think that it should be size eight. Right. So something like that. So you should assign toe values something like that and then print all these values outside . Okay, So this is your home or go if you have any problem, just asked me. Create a discussion. I will have you so do not war. The delicatessen. Thank you very much.
23. Loop for: Hello. My friend today would like to introduce you another type of loop we just called. Look for And in order to use it, I'm just gonna change. Why toe for? But now focus, please. I'm just gonna add here at cynical and here a cynical and it's gonna work the same, like wild. So why even bother using it? Because we can at, you know, space and here's place. And these places here are reserved for the thing that should be done when the loop starts. So for the initialization off variables that will be needed in the so, for example, this I right here, we have got the condition, and here should be played, something that is gonna be executed after each time. The loop is Ron. So like it. And now it's also gonna work. Fine, isn't it? Kill. So this look, I think looks better than why. Look, because you have got everything that is connected to look in one place, right? It is not outside of the loop somewhere here. And the thing that is done after each time the loop is Ron is not at the end. You can just look here and instantly see. What is this look responsible for? I like for looked the most from the lips. Okay, so that's something like that. Here is the place for Inish initialization off variable. Here is the condition and here are things that should be done. She so, um, things to do after each iteration. So after each time the loop executes everything inside its border and that's all OK? And of course you can, you know, initialize you more variable silicon. Something like that that we're not using now. So we don't need toe and you can do with the common also increase increase inclement ation off more variables. Right? So we could do something like that and something like that, it's gonna work. Fine. OK, so this space can be expanded. You should also know that the condition here is gonna be checked at the beginning. So we do something like that. Nothing is gonna be shown, so the condition is check at the start. So this thing is wrong first than the condition is checked. Then this thing is executed. Then we are increasing their, um the value off variable. All I and then we check the condition again. Bom Bom bom. Uh, until the condition is not okay, That's how it works. So let's change it back to something like that. So, youth, do I look, when you want to execute something at this one's use for loop in order to, I think my dear called clear. Why didn't do? Ah, why? Look, I think it's most I'm used by. Other pro programmers just prefer it, right? Is it really the preference? So, huh, use the one that you think that you like, But I really think that this one is better because you have got everything in one place and it's easy to read in one line. What? That look is gonna do the donated lesson. Thank you very much.
24. Enhanced for loop: Hello. In the last lesson, we learned about the four loop and in that loop we had to type lords off things. Here there is an enhanced for loop that you can use for situations like that enhance means that is upgraded. Look, it has good and other syntax. It is easier for situations like that. So how to use it? We just dive there for them parentheses and of course, the curly braces. Where is the body? Off the form. And now we do not type the semi colons and we do not have displaces here first for initialization. Second for conditions hurt for things to do after each iteration. But no, we just type the type off the a ride that we want to parts that we want to get values from . So in our situation it is what string? OK, then we type whatever we want. Yes, it's stroke. You type Here the name off. We're able that will store values after each iteration. After each time the loop, we go through the loop. OK, so it was stir one in the first time in the first iteration C plus presidency operating on fires Java, Java, android and so on. So let's type your for example, my value, right. And then we type the colon, and then we type the name off, all right? That we want to go to. So in our situation is video courses, and then we just type my value, right? We just take these here because its stores the value after each iteration, and now we won't come on. This. You will notice that when we around this Hey, it works fine. And of course, now you can add new thinks here, right job, the database, for example. And of course, it's gonna be also added, So these looks, of course, centered in this one, right? But in some situations, it's maybe not the best. Because, for example, what if you wanted to have a the Rabel inside, you would have that we can write. You have to create it outside increments here because sometimes you want to check what it aeration is. And then if it aeration is equal to five, you want toe, do something special, right? So you can do something like that. And as you can see once after the 12345 in the 50 it oration with Tiglao off course. Must I want to do something different? But hey, now you have got against something outside, right? So it really depends on what you want, toe. Exactly. Do. And you need to also remember that here, you can do whatever conditional statement you want. You can do here. You know, we can use the ah Amper sounds right. You can use the contraction, these Yanks and other things like that. You can do whatever we want. You here. You don't have something like that. You just go to all values inside. Okay? So it really depends on situation. Well, do you want to do? Okay, So let's take this other command and let's arm do comment here. And you will notice that sometimes even your i d we have you covered too far up. And as you can see, we instantly Ah, that the i d converted it instantly. And it also gonna work. Right? So we can There was this Concede control. Z control. Why? So that's that's the difference. Okay, The doing good lesson. Thank you very much.
25. Loop in loop: Hello today will exercise it bit. I will show you how to create a multiplication table using a loop inside another loop. So it's another exercise. How to use loops and sunny Another lips, right? That might be a bit difficult stuff, but I think this is gonna be easy after I show you this simple example. So how the US multiplication table Luca Well, you have got something like that. 123456789 and 10 And then what you do You multiply all this values by too So good then 2468 10 12 14 16 18 and 20 And then what you do you multiply No days row but the first row again by free So you have got this free six ok and then what you Do you have you multiplied by four So for a of course you know how it works But you should look as a programmer on this like that Hey, I have got you one So I want to print ISRO and then I want to just multiply each time the same wrong by to them free than four And thats well we can use something client looks so let's create a for loop and we will initialize here variable I and were assigned to it one because we want to start from one, right? And then if one is well, if I is lower or equal to 10 then increase that value. I So we do. This loop is gonna be executed now 10 times. When we do something like that, we see numbers 1 to 10. OK, but I want them next to each other. So we will not use the method print line. But we use the method print. Now they are next to each other. But we want to have a space between here. So let's create this place like that, using something like adding a string with the class operator, right? And now is you can see we don't have got an enter here. We should add enter at the end. So let's do it. But let's do it outside. So we're gonna do it like that system out print line and we not gonna send anything there. It's gonna just and at enter here. Okay, so now it looks fine. And now look, we have got now this first row here printed using this instruction, right, because this is really something like running this instruction 10 times. But let's imagine the disease. One instruction that in salt a task for printing out the numbers. And now I want to multiply all these values by what to then free them for than five and six and 799 10. So it's also a situation where we want to create another loop that with the outer loop right, this will be the inner loop. And let's create out of four Let's create here. Ah, let's declare a variable, for example, J that's assigned to eat one. And if Jay is lower or equal to 10 then J plus laughed. And now let's take it into the current of racers and we just need to multiply I by J and, as you can see now created multiplication table. And the coolest thing about this solution is that we can now create even bigger multiplication table, and it's done instantly, right? That's the power of our computers. If we did it manually, do take jazz tons of time. Okay, so and let's focus on how it works, right? So let's do stuff like that in the common. And at the beginning, we're assigning toe J one. So it equals one. And we check if one is lower than 10. Yeah, so OK, let's let's go to this loop. Your do you have got an extraction here? So we declare I and we assigned to it one. And check. Hey, it's one lower than 10. Yes. Is Lord in 10? So Okay, so let's print out what? One multiplied by one. Okay, let's do it. And let's bring space. And then what? The instructor? That first part of these Look, the first iteration is gonna end, and we need to know that they think here is gonna be executed right at the end of the four Hope. So the eyes gonna be increased to two, and we're going check the condition if do is lower than or equal to 10. Yeah, it's It's so two multiplied by one is still and we can increase it. So free it's free. Lower than or equal to 10. Yes. Free multiplied by one is free. And then 456789 And and then 11. It's 11 lower or equal to 10. No, Okay, so it's the end off execution of this for low. We ended because the condition was not mad. And we execute the print line. That's why we have got here. Enters right after Pedro. And then we gonna walk. Well, the first iteration, the first pass. Because we could imagine here as it was one instruction, right? Let's imagine that it would be something like, you know, printing one instruction took this instruction has ended, and then we have to increase J. So we increase it to two, and we check the condition is still a lower or equal to 10. Oh, yes, it is. So the condition is met and we're gonna execute this thing again. But after you that four loop has ended. We lost the very well I so way are declaring here again. So it's again it called to one and to check its one lower or equal to 10. Yes, it iss So we gonna just show to the person one, but multiplied now by two. So it's school because now he was something like that. That right it with second road that is gonna multiply all these values by two. And because of it we're gonna see is the result Israel. Ah, And because we have been to free 4567 right and to 10 and all the time these these values will be multiplied by the static value to And after ending this this'll lope execution of this loop, Jay will be increased. And then we will multiply every number like that by free. And that's why we're gonna create another row. That's awesome, right? Maybe complicated at the beginning when you look at this, but don't worry after, you know, do things like that a few times you gonna feel flu ending things like that. So what you should do after business, and you should write it young on your own. Okay, this is a good idea to, you know, close this video now and try to not look into the coat here and try to ride it on your own would be a good exercise for this lesson. If you have any problems, just feel free to ask. I'm always Ito best records
26. Break and continue: Hello, my friend. Today I will show you how to break or continue the iteration off. Look what that's in section break and continue means so here we have a loop a simple one that is gonna show values from 0 to 9. And now imagine that we would like to see only the year old to for So I would like to see even numbers, right? Or maybe I would like to see old numbers The one free five, 79 How to do it? In order to do it, we have to know how to use, continue and break instruction. But when you continue for this one But it would be a good idea to also there about how brake is work. So let's do something that lets greet a conditional statement. If I is equal to for example six, I would like the counting. What does it mean when they executed you will not. Is that six disappeared? Why? Because continue is working like that. Stop execution. Both the interational. So one of the parts of this look right stop the execution of eight oration off the car and reiteration, but continue. So it means that every instruction after this one won't be executed. So this thing just didn't execute writing because more here like that. You would notice that Well, you have got when we should have here. Six. It's not that right? All instructions here from this place toe this are not gonna be executed if the continue instruction is executed. The break is a bit different. Is just gonna stop totally this for hope. So break knees. Hate break, man. I don't want to execute this loop anymore. Brake is used in situations where, for example, somebody clicks on something and you want to stop the loop, right? You could check here all the time. If somebody creates the button, then break. But well, nobody has quick anything. So there should be some operations executed, right? In our situation, we need counting, right? Because, well, we do not want to stop total execution of follow up. We want to c zero to for ah, seeks eight. And for example, 10. Whatever I want to see see even numbers or old numbers how to do it. Well, we could use the model law operation here, So if I multi two equals 20 we're gonna counting you. What will happen? As you can see now, have good numbers. 1357 and nine, Which are old numbers. Eso How does it work? Well, we assigned to hear toe I zero and we check is zero lower than 10. Yeah. So zero wanted to equals zero. Yeah, So this thing is gonna be executed. And because this is gonna be executed. Instructions after continue are not executed so well, not C zero. But later, when the eyes gonna be increased, we're gonna check. The condition is one lower than 10. Yes, One more to is one, and it's not equal to tense. The condition is not met. And, well, this continue is not gonna be executed because condition was not met. And we're gonna see on our Hugh Output one. So that's why we can see all the numbers. If you did a dead way, we cannot see even numbers. The coolest thing is that now we can execute large of them very fast. Right. Okay, so that's how continue and break works. Now, let's see how it works here when we have got to looping Southern. Other than so this is how the example What would happen if we do something like that? If I equals, for example five, I will continue as you can see the comb. Five. These appeared totally Why? Because every time when I was equal here five right? It doesn't matter what Jay was. 1234567 Whatever the instruction here was not executed. So we didn't want to ply five by 1234567 So that's why we I removed the column. Right Column The fifth call. If we did something like break here, you will notice that all combs after five days appeared. That's why Brake. That's because Sorry, That's because break leaves the inner for loop. Okay, is not gonna break Desslok on Desslok break. He's gonna just break the loop. That was that. It was executed in so dead one. And that's why when I was equal to five, it left because of the brake function we left the for this fall Look And well, these four loop seed execute. So the J was increased. And that's why we have got another awesome. It might be a bit hard for room start toe. You know John from something so simple. Like that stuff like that. So do not worry. You just need to trying a bit as an exercise. I like you too. Right now. Try to somehow print every second row. So you want to print this one? This one? These one. Okay. And if you have in the problems, they're not war. I will have you just created discussion. Discussion? That doesn't mean that lesson. Thank you very much.
27. Summing many values: Hello. Let's training this lesson and let's create a program that is gonna soon up. So at all the numbers that are inside this area, how to do how to sell the problem like that? Well, if you're gonna add each time a number, it's gonna be forest emailing extraction. That's why you should instantly think about using a loop, right? You want to execute very similar code. So when you talk so store it somewhere. So let's create a variable that we stole the sit some. So let's call it like that and it's good idea toe assigned to it. Zero. Why? Because when you're adding zero toe one, see, it's still one. You need to have a natural value in order to do something like some plus equals numbers off for examples here. Right then you are adding, you know, at least at the start value to the notary value. That's why it's not gonna change. You did something like that. The result will be different, right? And that's why we need toe assign here at the start zero. And now we need to create a loop so far, and that's creative. Rabel I And if I is lower than the numbers length and I plus block we assigned here to the I zero because I remind you that we number old values. We index things inside a rise from zero. We start counting from here. That's why we starting from zero. And now we can just at two, some some plus numbers of I And then we can just send to the output this sound outside of the look right. And when I execute, we instantly can see the result cars again, you know, Do you know something simpler? So one plus two plus free, it's six. And as you can see, it's working fine. You can upgrade either date. You can do something like that. It's gonna look a bit better, right? And you can upgrade it even more by using the enhance for all so we could type here the tide off the area. We won't do go to so end, then, uh, name over a bill that will be storing values after each iteration off each place. You right? So for example, number and then we type cone on Ben, the name of Ari wants to go to so numbers. And we were not types. I think that, but we just typed something like that. And as you can see, it's also gonna work fine. And it looks I think it's more read able men. Right? Okay, that's only the lesson. Thank you.
28. Object Oriented Programming Overview: Hello, my friend. Today I will give you overview on the topic that this cult object oriented programming. But before we talk about this, we need to say we need to tell ourselves what is an object. Because, hey, this is going to be oriented programming around the objects, right? So we need to create something in the Java language that will be connected to objects of what is an object, how to create it, how to use it. Why do we need it? So what is an object? Well, object is everything that you can see and you can describe. Okay. All right. Now I am looking at the monitor. I am looking on the things that I have got on my desk. There are lots of things here. It's even hard to, you know, move on my desk. That's how I work. But, hey, there are lots of things. They're all objects, and I can describe them. So in object oriented programming way, you want to describe things and you want to describe them because you want to call nicked all their things that are, you know, similar to each other and have them in one place for the future usage for future changes for easier future changes occur So object oriented programming. It's cool because you can work with many people because it will be easier to work with something that is, you know, set once properly. Okay, so objects Well, I said you are containers also that stores variables and function automatically connected to each other for easier future Use it. So, for example, when I'm looking at this monitor, it has good with it has good height. So this is the properties. These are features So part of something that describes the item Okay, this object and where this monitor can be could closed can be opened, right? It can be e I can change the brightness. So these are methods, functions and these describes the things that can be done with objects. Okay, what can you do with objects? Is this guy by methods and functions? So let's create this very simple one class of, for example, cost more knitter and a Class East's a form for creating instances. Instances copies off objects. Okay, so classes are used to create objects. So I'm just creating right now a clause that is called monitor and I am using the Curly. Brace it to say where I want to describe things that will be describing monitor. And here I am going to create, for example, of two variables an integer we even integer height, okay, and well with is gonna describe the waiver monitor. And Heidi's gonna describe the highs illuminator. And these things are called properties. Okay? It is very important. This is properties. And now let's create mattered. So something that can be done with monitor. Okay, So for example, void and ah, change brightness. Okay, Something like that. So this is a method method that can do something with the brightness. Okay. So I can also create a variable that will be called brightness, and it can be later changed using this mattered. So, for example, we can send an argument, other things like that. But we will talk about things that, like that in future lessons. Okay, So things that will be done by method are gonna be described between discourage brace er's and well, so this is place for instructions to be done. That void think can be really something. Guys, it can be bowling can be many types. It is the thing that is gonna be returned by the function when he's involved. But all the things like that, we'll talk about later. Okay? So don't worry about this weird keyword here right now. You just need to understand what is objective programming and why do we need it? Okay, so I just described a more inter like that, and because I have got the monitor one monitor, it doesn't mean that all off the monitors will be the same, right? Well, we can have many different monitors, and we can create using classes, right? Many monitor so I can create, for example, in the main mattered. Um, a new object using that monitor class monitor can be used as a type, as you can second type monitor. Now the name of variables off, for example, monitor one whatever. And now I'm gonna type equals sign and the new monitor, which means reserve for me in the memory in the random access memory at place for these properties. And this method good can be later invoked. Okay. And as you can see now, when I type more inter wam that as you can see, I can access the brightness that hide the with and I can change brightness, for example. Right? So let's access. For example, we even study toe 1000 and let's send it to the output. So like that, and as you can see Hey, it's working fine, right? Well, we could also do something like get with. For example, we could create a mattered right And we could send to the output the week that we have got here. OK? And we could do something like monitor one get we've using. These method is called invoking off methods. Okay. Um well, this ah thing should be looking like that. As you can see, we have got 1000. Now why we have to go have this here not inside the system out Prince line will talk about later. Okay, But well, as you can see, it's cool because you can now have seen things methods connected to monitor here we because right now we have got very small programs, right? Imagine a situation where you have a good big program with, like 10,000 off lines. It would be very hard to keep everything in 15 and in one Clausing, while whatever that something like that it will be just horrible. But using classes, you know, you can have a class for morning toe or you can have a class for a keyboard. You can have a cost for the printing device and other things like that. And then when you want to change something, going to want to look for something is gonna be just a Z and is it fine, right? That's why it's so cool. So the cool thing about it is also that I can create another monitor so I can create another type of Arabia which will be called monitor, for example, monitor to and create a new monitor. And now I can type something like monitor to and change the wave to, for example, 20 thousands and off course. When I use the monitor to get with matted, which is executing this thing here, right? It's like, Hey, I'm gonna jump from here, took him and execute this code here. So, balm, as you can see, the 20 thousands and I type here and well, I can, for example, invoke first this than this. We have two different instances. We have got to different copies of objects. That's the coffin. Great concrete men and different monitors. This is just a blueprint. This is just a form for creating instances, right? Lo brains, maybe, maybe even better work. And you might be like, Hey, this is very tea or eat a cow example. Yes, it's kind eyes, but it's easy to understand it then. But Okay. We've been already using classes. We created something go, this called strength. And if we tied, for example, name you will not. Is that inside of it? We have good access to many, Matt. Its many functions that can do something with that value like that with the sequence of characters. Right. So, Aiken, type something name dot and now I can, for example, check what is the character of the position for right? And we can send this to the output so we can dio we can do something like that. Easy, right? And it's the so their man emitted that you can use inside of it. You should also notice that you should name your classes with the big letter. Okay? With the upper case at the beginning. And you should name matters with the small letters that this start. Why? Because then it's easy to, you know, see what's what in your program, right, You can instantly see Hey, this system is really an object, right? And it's true when I types system that I can access some methods here and some properties, right? That's very cool, Onda. Well, when something is starting with the small that there is gonna be a property or it's gonna be and met it, right, So it is very useful toe name to use the convention of naming your classes like that. You have also probably notice now that finally, we understand what's going on in our program here we have got the clouds right, And this classes public class. What does it mean to this public it This means that it's available everywhere because, hey, here we have got the package package means that we have got everything sorted in one place , like, for example, the classes. And when I create another class year So when I do something like that, as you can see, we have good. We can have many classes. They're owning the same package right in this package here and well, you can have your own packages and there are many other packages created by other people by , for example, creators of Java or other any people. You can find things like that like, for example, frameworks on the Internet and you can import these packages here using the import keyword right. And your package can be also important. How to do talk about the next lessons by, But you can import them. And when you are used to think the here something like that, it means that it cannot be imported. Okay, when you don't at public, it means that this glass is gonna be on leave able to this package of you create another package. So, for example, like that, and you create hearing sight and other class and you would like toa act us things from here , it would not be just possible. Okay, if there is no public behind the class, but if there is public means that's available everywhere, the same goes for the public here, Okay? It means that it can be accessed from anywhere. Well, I will talk about those so static. It means that it's available all the time method. Okay, Andi. So it means that it's even available when you didn't create your class. So that's why it's the static is need before the main because main mattered. As I said in the first lessons is the method that is gonna be executed as the first thing when you play your program, right. So it needs to just exist at the start so we can execute all the instructions here and well , he was a world called Void, which means that what is gonna be returned by the main function when he's gonna be executed and void means void, which is nothing. Okay, we'll talk about the returning types and how to invoke met its more in next five lessons. And of course, here are arguments that can be sent to the main matter later and they can be used insight. Um, these method right the same for this change brightness, we can send your something and change. For example, this thing well, we will improve our skills, our abilities in writing things like that in the future. Well and both 10 lessons. So this very long, but also very important topping in orderto understand anything in Java. Okay, if you understand this part of programming well, programming anything in Java is gonna be just easy. Okay? So keep with me. And if you have any questions, just feel free to ask. I am always here to help you, but records
29. Constructors: Hello Today I will tell you what our constructors and how to use them in order to show it our create a class that Wilko appoint. So point is a class and the class can be represented by properties. What properties are representing the poor? Well, it's coordinates right x and y. So let's create properties like that X in X and and why? Okay, so now we want toe create the point. In order to create a point, we type new keywords which will reserve in our random actors memory that place for our new object that we gonna create for the copy of object for the instance of the object. Okay. And we have to type the name off the class and then parentheses dead are invoking the constructor. Okay, this parentis is with the name off. The cost is invoking the constructor, the default construct. And now we created something in our memory. But well, we didn't create a reference for this thinking, right? We didn't save it in the world. So we'll be just did it. It also and something. So we should save it summer. So we should create a place where we could story so yeah, we have to create a variable ever able with will be called this time an object. So we have to type a type of are able what type of the object we want to create and we pour Call it point and for example let's call it well, people. And that's a sign this into this. Right? So now we have got the raft friends. Now we have got something in the memorial where we can point to So this thing is called involving vocation off that default instruct constructor and you assign it to the variable with this P Right now there's an object now and we can get to the X and set, for example, the values there and later we can show it to the output. And well, as you can see, it works fine. But what would happen if I wanted to? Xiang's the values, the coordinates using the constructor Because what constructor means it's gonna construct something the way you want to construct. If you have to do something like that each time, right? Imagine something like that Bomb, bomb and not be too. Be free and then now hear different values, right It's just horrible. Called You have to do lots off lots of counting like that. And now imagine that you have got, you know, more properties like 50 of them, right? It's good idea to keep everything simple and close. So it's good idea to keep everything in one constructor. Did you gonna create on your own? Let's create a construct. In order to create a constructor, you type the name of the class you want to create constructor for than the parent disease and this curly braces Okay. And this is the default instruction. And I mean constructor that a that was involved here. OK, so this thing is done automatically, as you can see, nothing Question. But if we do something like that, this is default Constructor. You will notice that Yeah, this is the thing that was involved and default in constructors are used to, you know, set some default values. So, for example, let's say that I want to have default values. Ah, 101 100. As you can see here we have 10 and 20. But it's because of this to Lynskey. When we delete them. As you can see, it's 101 100. So we said the default values when we delayed it, it 00 default values for the integer inside the class is just 00 Okay, But even to change the default behavior, you can use the default constructor. But if you want toe, create something more, right? Do you want to go? For example, sent here, for example 10 and 20. You need to create another constructor with parameters. So you gonna declare he, for example, first parameter and then the second parameter and well, right now is you can see we don't have errors. And we didn't see also the method disease. The default constructor is because this constructor was executed. And now we sent here in the line 17 10 and 20. They were assigned to these vory variables here. So too the first and the second variables. And we cannot ascend these values to the values of actual object so we can type something like eggs equals first. Why equals second? And now when I run this program, as you can see, it's 10 and 20. So now when we want to create another point, we just need to do something like that, right? P two and then, for example, four and 25 right? And now we just to copy these things. So bomb and feet, too. And as you can see, it's working fine. So constructors allows you to do thinks that are constructing the object once, right? You don't need to copy your coat. So because off it, if you had, for example, some conditions here, here, write many instructions you wouldn't need to copied. Each time you you wanted to create another object, right? This is the place for constructions conditions, for example, a far these lower than 100. Then I want to change the 1st 2 for example, um, 150 right? That's why we would notice that we have gotten now both times 150. So it's like, Hey, if the first is lower than minimum requirement, right, so we could stops on the minimum requirement 100. Then you have to, uh, changing toe 150 right? So you, you know, get it. If if not the constructor, you need to make for each object something like that. And if you wanted to change them something inside the cold like that, you would need to changing every place to use it. That's why constructors are also right. Right. Okay. So to sum up, constructors are constructing object. That's only did Listen, thank you very much.
30. this keyword: Hello Today I will tell you about a key word that is called this in the last lesson, we did something like that with constructors. But look, this thing here is no the self, the script Evening. 1st 2nd Really? Maybe we could call it X still. And why to then? Oh, yeah, Maybe it's getting better, but the truth is that it is just no sense toe. Create a new name for it. It will be best if we could do something like that right now it looks 10 times better. The problem is that computer doesn't know. Now if we think about these six or the X that was sent here, right, the 10 here was sent bomb to this place. We assigned this stand to dig his ex on. Then a we'd run his wheat and you can exactly tell the compartment which one You want to act it by using this cure? Okay. When you do something like that, you say that you want to exactly actors this element, so you if you have a conflict of names, then you should use that this keyword in orderto exactly say that you want to access the current value off object. Okay, so this in the city, in the situation like, for example, in the line 17 it would be like P that X right p dot Greg equals the X that was sent here. Why Did was send him so. But in the light 18th it will be Peter. Peter. Okay, so this is gonna be replaced by this. It really depends on the situation. Where you gonna involved, Right? Um, I liked. Also add the these variables are court parameters. OK, parameters and values that are sent to the constructors are called arguments. Okay, So here are temporary variables that are called parameters, and you need to know by temporary that I mean that they are deleted after this kind of brace. Okay, So these values that are sent you 10 and 20 our local copies for this Bolden off constructor. And after the the ending covered brace, sir, they stop existing. Okay, the selling that lesson. Thank you very much.
31. Methods: Hello, my friend. Today I will tell you what are met its functions, how to create in and why do they need it? Function is simply a block of coat which can be invoked executed as many times as you want in different places in our code by us or even other people. So far, we've been using something like that. Look, when we do stuff like that system that out that print line. As you can see, we have got human versions and off print line and we can send for example string right, you consensus like test and we can see the message. So there is a block of cold summer. There did. We are executing And the cool thing about methods is that you can now simply do something like that and everything is still gonna work right? We're executing the same code each time. And now if somebody who created the print line method, I would like to improve it, for example, he just invented a new algorithm for so it will work faster. Right? Then he will just change it there and we will see the result here with without using something would would be called a method he would need to say to everybody Hey, you know, you have to know change your called in order to make it faster. This will be crazy, right? For I just cannot imagine working without something. Will this called methods? Okay, so let's create a sample cost recall test and we learned the syntax in this lesson. So this will be a theoretical examples, okay, Off methods. So you will know them very well in future will, right, Some better methods. But before we go into writing it, I like to tell you that some people might have problem with me because I'm calling function methods and meta dysfunctions because well, in other languages, oh, functions are outside of classes and things that are inside classes are called medicine. That's the only difference that's proving. This is that in Java there is just no difference because there is just one type, right? Everything is inside the class, so you can call of them all of the matters. But if you call them functions, nothing wrong Well happen, OK, when you look at the name function these cold like that because as the name suggests, it's taking a role function of doing something right. And what is the matter? Because it's a matter for resolving the problem, for example, So methods can be used, for example, for printing something out. It can be used to get something from the import from the forms, or it can be used to calculate something. Right. Okay, let's go back to how to create and that in order to create a method first, you need to type what is gonna be returned by the matter right now. We don't know what does even return means So will return laughing Res void, right? Void means something empted. Something like emptiness. Right means nothing. So we're gonna return void, nothing. And now we need to call our method. It should be self descriptive right now. Let's go. It, for example, Praying something out. Okay. Our method right now is gonna just print something out. Okay, so let's do it. Something out. So now we want to invoke a mental like that in order to do it first willing to create and instance off the cast right wing to create an object, and we could need to store it somewhere. So let's create a variable off type test. Let's go eat, for example, A And let's now reserve in our memory using the default test Constructor that place and saving doing right. And now we can print, as you can see using. There's something out. Yeah, it works pretty fine, right? We printed this thing out. Okay, so that's no Maggie, the Big Carter. What if I wanted toe bring not something out but water? If I wanted to bring my name and Starling Oh, then I showed it's create a place where we can start these values inside is method temporary. So we need to create it. Power matters, right? So for example, Sprink and now name String on. Sorry. And now, as you can see, the I d. Says that that something is wrong because there are no arguments we didn't send any. Think you. Okay, so now we can send them, for example, my name and my Suning. And now we can print this thing out so we can do stuff like name and this paste Plus, for example. Certainly as you can see now it works are Egg Budaj. The cool thing is that I can very fast bring many things more, more, More than one thing grind on another coughing. Is that if I, you know, did like I know 1000 times in different places of our code imagined that the we have got many classes and we use this print something out method many times. Mm. And for example, I'd like to add enter right. I would like to at also information like name like that. And the cool thing is, now, as you can see, we're going to do it in one place. Look, we are doing it in the function. We're just changing it only in one place. And as you can see, it's been changed everywhere, right in every place where we executed this code. Because every time when we do something like that, we execute the coat here, and that's the reason we are using Also matters, right? You changing one place, and it's gonna be changed in every possible other places where the method was invoked. So invoking the function means using this parentheses after the name of the method, and you can sometimes send arguments and the place where you involved omitted is gonna be replaced by the return. Think right now, is replaced by voice. So by enough, but sometimes you want to, for example, do something life, for example, adding two numbers how to do it. But then I type first the type off thing that I want to return. So in our situation, let's say it's in Teacher. So we gonna, for example, at two numbers. So at we'll be the name of our method. And now let's create parameters here. So, for example, into dry in teacher why? And as you can see, the I. D. Says, Hey, you are missing the return state and you have to return something. OK, so let's return. For example five. What will happen when we do something like that? Uh, A at 100 and for example, 500. What we happened. Second thing. Nothing happens because the thing that was returned the five he's right now here like that . Okay, it's just simply here standing and it was not assigned in the world. So we have to assign it. We have to creative a rebel. That will be the type of the return variable here. So, for example, in teacher and whatever and the same the at here, right, that's going Maybe result. OK, did this will be better served the script, his name. Let's send it to the output and as you can see now have good as there is old fight. Okay, so it works. We returned fight, but we want to return the some off this, I think. Oh, so we just need to do something like a plus. Why write only be Let's go eat aches and why 600 when you change something here, Free counter and 20. So as you can see, you can return something right Pretty easy. Okay, Lets train a bit and that's create divi Ah, um edited with divide two variables. So we need double right now because it can have a fraction. The result can be a fraction the right. And now we call these, for example, Divide in the end. Why? Because you can see I can name for Ebel's the same in another method. It's because these are local very booth, which means they are destroyed after the scared abrasive. As I said in the last lesson, Well, because as you can also a zika probable some notice the method is looking very similar to construct er the constructor is really met it. But that method is not returning anything. It's just constructing the object. And then you can saying that object to, for example, of a rebel like that, right? So OK, let's of course, these will be doubled volleys. Now let's divide them. So do something like that. And now we're here. Divide, um, and off course. You need to return it to the same type. And as you can see, the result is 0.4 500. The result is okay. But what will happen if we type here, for example? Zero. As you can see, we have got here a message. Infinity. It's because you cannot divide by zero. And the truth is, the double is, um really when you're using it, it has got something. What is called the rapper. They're all power, something that on and it's used. It's doing something like, you know, it has good methods. When you do something like that, double A. As you can see, I created it with the big number. As you can see, there are management IDs inside the claws like that. But what? Maybe not. Let's not go into this topic right now. But what as we have got the result infinity here. And we could, you know, check before, For example, if why equals zero, Then I want to return for example. Zero. Okay, I want to decide to. So so something like that happen. And as you can see now, we have with zero because these instruction was not executed. Okay, you could also You know what? Let's do something like that test. As you can see, instructions below the return are not gonna be executed. Because when compilers sees the returns instruction, it's gonna return, right. It's gonna job return to the place where the method was involved. So here, and he's gonna replace this by the thing that was a polite. So in our situation, it's zero. And because zero is really know, the double is gonna be changed. So 0.0, because this is available. It is a thing with a fraction with zero right now, but, you know, it's maybe a bit complicated, but, hey, that's how we'd work. So that's how you create very simple methods. And as I said, they are very useful because your code becomes clear. Everything is in one place. When you look at the name off method, you can instantly sit see what it's gonna do, and you should remember to keep methods and properties that are, you know, using, for example, also met it, sometimes inside classes that will be connected to each other. Right? You shouldn't create a class like I created here that, you know, do something. I bring something out at divide. Well, maybe. Well, it could be called math class or something like that. And But, you know, you have to keep everything connected. The one t meth. Okay, Everything must be created in dead way, so it's easier for future usage. We'll talk lots off more about methods in future lessons. We will create more practical examples. Do not worry. You have any questions if you do not understand anything, just asking. I'm always here to help, but its records
32. Overloading methods: Hello, my friend. Today I will tell you about overloading off matters. Well, let's create an example. And I think that we understand it better because of it. Look here We have got and matted that returns integer and I'm adding to integer numbers. What do you happen if I did it? This and I do something like at two values that are known in teachers. Like for example Det, right? What? What happens now? We have good exclamation mark. Incompatible ties. Possible losi conversion from double toe end. And what? It's not gonna work. Okay, You have to know, Change it to double, double double. But double takes more space that etcetera. And, well, it's good idea to just have another minted dead will be called the same. And, well, this iss, the overloaded ink off methods. Okay, you have got the same name but different parameters. And your compiler knows which want to choose, because off the arguments that are being sent to them mattered. So now when I type double results and I send it to doubt, But you're not, is that the output is double. But if I change here to something to for example, 15 and here to for example, 35. It's gonna execute these one, right? Oh, well, we inset into double. That's why we had zero there. Everything works fine. And as I said, you here, even here they used the overloading off methods, right? If they didn't overload here, all methods we could, for example, in the sense string stood out. So things like that are very useful. Andi, you have probably noticed that we're creating a default constructor. And then we created the constructor. That could take more than one argument. This was also called overloading of constructors. So overloading means that you have got more than one method or constructor with the same name. But you want to have different numbers off parameters. Okay, that's going the lesson. Thank you very much.
33. Static keyword: Hello Today I will tell you what the US this word started means before the methods and before the valuables. Okay, so let's create a clause that we call month. And let's create a matter that were asked to numbers, for example. It will return double and we'll call it at. And now we will take here two variables. Now we should return there some off them now. And this is very not cool. We have to create a special object. So, for example, test and do something like that and now we can is the invoke the admitted sending their something like that on signing this to, for example result. And when we send it to the output, you will notice that we have got the reason The problem is that, really do I need to create an object in order to add two numbers. Sometimes you want to have your metal exist all the time, always how to do it. You just type starting before the type that is gonna be returned. And now, as you can see him. But here an era are well, the worrying, because it will work the same. But the cool thing now is that you can access it to the name of cloth. You don't need to create an instance off discussed, right. You don't need to create the object. You do the work the same. So if you have a specific, you know mattered the Do you think you don't need an object in order to invoke then is it's time to use the static. Okay? And hey, here is a static. Why it's here. Because when I carry Graham, discuss que it's not gonna be created, right? But this metal exists even if there is no class, no class object, right? No object created by using discussed deads lie. We have got your static because this method exists always and it waas involved. It could be involved because of it because of this world. So the static here, as you can see, allows you to run something even tell. We did not create on the object. Okay, so how does study variable work? Let's create the class that we call Cleon. Ah Oh, customer. And now let's create here, for example, property like name and let's create the property Did will be, for example, I did I d will identify the customer right? Which one is which? And now let's create a constructor. Did will take here the name and we'll assign to the name the name that will be sent here. Okay, so now let's take this under the comment. Let's create customer new customer and we're gonna send their, for example, my name. Let's create more off the customers like that, and we have just created free customers, not like toe assigned toe I d. Different value like 012 But hey, I don't want to type. You're like zero than one done, So I would like to have it done automatically. How to do it. Well, what will happen if I do something like that? I will, at plus one, to the existing idea as a sign at the beginning here. Zero. And let's see what's inside like that, eh? A dot the on A B and C when I ran it. As you can see every time I have got one. Why? Because you have to remember that when you are creating an object, it's different object, right? And every time when I'm adding one, it adds to the current property off the object of the car and object right on. And if I want to keep something always the same for all objects, I need to create something called this cult static variable so I can create a static and variable. The diary called, for example, next I. D and I assigned here wine and now I can assign here, for example, next I d. Right and I can increase the next i D by one after death. And now we have God want to free. Why? Because next, I d is gonna exist. Always. And it's gonna be always This is the same, right? Well, it's good. It's can be changed by, for example, and in another place, whatever. But it's gonna be always the same for all objects, for every execution of it, right when we do something like that. Now, for example, we get into the customer, we can get to the next I d. And we can check what will be the next idea off the next user. Right? But this idea here in the line 44 it's a property that is gonna be the value will be like for the current object, right? For example, ABC. Okay, now When you look at this here, you will think high dirty is too much off writing, right? We could change it a bit. Well, let's create Ah, an area so we can create an area off customers. So, for example, P new cast, Elmer. And now, for example, we won't three people. And now I can do something like being off, for example zero. That name equals our Kardashian. Now, I can do the off one people to mm. Or Well, well, the truth is that this thing is still not gonna work. But I want to show you what? Uh huh. B one B two and bomb isn't working. Why? That our eyes only read from never written to Why? Because here we're trying to access something that doesn't exist. Really? We created here a space for free customers, right? But we didn't use constructor. Look, we didn't use this constructor. He right? We have to use the constructor for each element. So we have to dive something like that. The zero equals new customer, okay? And I was gonna give so we have to do things like that in order to create more more people . Okay. Something like that. And now okay, now is working fine. And now there is one more thing. Look, static means that it exists always. It also means that if the object if the class, if there's something in class like starting admitted exists always it cannot access finks that might not exist yet. So if I created, they're able here in a inside this class, right? Or inside this glass, I cannot actus for that's really different a bit like that. I cannot access this, right? This that well What's this here? The static method always exist. I cannot access something like that because hey, um if I had, for example, 10 customers which one I actors using this Gil cable, right? This is really accessing current object. But there is no current object yet because maybe it's not created yet, right? Starting method exists always. That's why you cannot access Also hear this thing here, right? You cannot do it if you want to act, is it? You have to create special methods. So, for example, voids sample And now from this method off course, you can access it, right? You can change it but also in order to use the method. You cannot do something this dot sample, right. But you have to first create, for example, Stichting content a lot new stated content and now using these variable then you can access , for example a or the method sample. It's very important that from the static content you cannot access thinks that are not static, right? That did not always exist. Okay, that's only the lesson. Thank you much.
34. Packages: Hello, my friend. Today, I will tell you about packages and about modification hours. Four classes for methods and for varieties. Okay, So what is a package package, as the name suggests is something that wants toe park classes with methadone. Very bruising site that are related to each other by subject. Okay. So they must be related to each other. Right When we have the package called video courses, I would like to have here classes that are related to video courses. Like, for example, this class like, for example, box David E. And other things like that. We want to have everything to be easy. Toby. Easy to maintain. Okay. Why? Because, well, your program might be big later. It doesn't need to have only one closet can be 1000 of classes. Look, you can import using the import, other packages, key word. And when I do counter plus spaces, you can see we have got to have a few packages. I can go to one of the packages and there is another package inside the packages. And when I go to, for example, this one I can get in tow classes that were created by other people or maybe into another pocket. So because of it, everything is easier to access, right? They have the place in, You know, the big amount off classes, if they were all in one class in one fight, would be just horrible. So that's why we need pockets. Okay, there is another how to create a packet, you dye packet than the name of pocket. That should be the same meaning like you and the same name. Like the folder like here. Because this is really a folder that is gonna start classes. And inside of it, every class that this below it is gonna work. Work in this pocket. Okay. Uh, no. What will happen if we have another pocket and I want to act his things from here? Well, let's do it. Let's get the package. New Java pocket. Okay, let's go. These new park it it doesn't matter. We just want to to your attic, Carly. Do it. And that's great. A closet there. We can get called new class. And now we have got two packages, new buckets and video courses. Okay, Now let's create here. Using the control plus space. The method studied Method main and Let's try to access something from here. That's for example. Try to access this guy here. The video cars. Can we do it? Well, we have to first imported when I type import, as you can see. Now we have the new package video courses and I can import this class it from there. Why? Because this class has good public before it. If you want to make sure that discuss cannot be used in other packages, you want to delay this. Okay, then. As you can see, you cannot import it here. Right? You cannot import it. But if you change back to public, it means that the US public and the accessible in every possible package. So no, we can use it by important here, video courses and now video courses. And then we can create the instance of its of video courses and equals new video courses like that, right? Yeah. Without importing, you would need to type every time the name of package that new Valeo crosses that. And it also would walk fine, so you can use it on the because of it. If you create any class inside here right inside one of the fights. Example, right? Like now, for example, class test and we create a stop Take Think here like that You will notice that we can access it from here. That's dot bank, right? That's why that because this class here it's package classes and wearing the same pockets right in the other courses pocket. So we can access It is. But can I access it here? Well, let's do it. That's that. You cannot do well. Can I import it? Import video courses? I can only import video courses. You can import all possible classes using that Asterix from from one of the pockets. Something like that. Okay, well, so we important on this guy and we cannot use the Stasi. Can I make it public to make it work? No, I cannot do it. Why? I can do it. Death is because you can have only one public cost per one Java file. And this cask has to be called the same as the fight. Okay, so you have to create a new class for that, for example test. And now here. When the cup feed Teoh, If you all right, then we can easily access it. Also here past that go video courses that were imported right? And now when key test would That's why. Okay, As you can see, we cannot access. Somehow they think here you might be wondering why, Because it's public. Yeah, it's probably. But by default, it's good that I made this mistake by default. Everything inside the class is package has got a package pontificator default Modification is always pocket. Okay, so it is that it's not accessible from another far. So here I can access it easy, right. We can send you to the output test A. As you can see, it's working fine. Everything is okay, but and it's OK because we're in the same package. But here we are at the package that is called New Pockets. Right, So we can import it because it's public now, But we cannot access it because it's not public. So you have to type here public, and now yes, you can do it. That's that. A calls went and you consent to the output, for example. Uh, this thing, right? So test a And if you want to run exactly this general five from another package, then you creek, right? Click here and then around the fight. As you can see, it's went So now you can actually, because you type your public. So if you want a toe, have your class to be shirt by other packages. To have variables to be shared in other packages, you have to type public. Okay. Otherwise it will be on the accessible inside the pocket. It was created in okay. And you know, most time you really don't want to do things like that even more You want to make things private. Private means that it can be accessed only inside the class it was created in. So if I type in private, we will not have access to it. Not only in the pocket that was created in we will not have actors. Even well, we will not have access in Ah ha! Other package. And also in the package it was created in. Right? You can access now This variable only inside discussed on Lee. We create here, for example, a sample method. And now here I can act. Is this a and assigned to it? For example, 25 right? You can do it only from within the class. Okay, Note outside the car. You cannot do it. This thing is called encapsulation. We'll talk about it more. Why we need things like that. Well, for example. Well, in the last lesson, we created some people that was called next identification. You should know that we could wish we could also change this identification all the time. Right? We could change this idea from outside of the cast. It will be horrible if somebody changed by Mr Right. We wanted to have the i d to be increased one by one. What we Some other changes several somewhere. He shouldn't be able to do it. That's why sometimes you want toe use the private here. Okay. Modification is modifying how things can be access from another scope. And there is also something with this God protected. But in order to understand how protected works, you need to also know what these inheritance. And we'll talk about the protected keywords when we talk about inheritance. Okay, so after these, listen now you know how to use public key workout to use default keywords what our packages there for, You know, having your code easier to maintain right to share view of other people and the accesses. The modifications like public, like private on and the default one. The package pontificator issues so you can changed how things can be accessed, right? So because sometimes you don't want toe make people access everything because it can lead to some errors. And you should know that when you're programming in object oriented way, you want to have everything in many parts. So one part doesn't need to know about another part. You should think it as the in real life, for example, carries working. You have got, for example, engine right and inside engine. There are lots of parts you don't need to know about. As the user of the car, you just need to know about staying will, how to turn left, right. You don't need to how things work inside. And if you as the loop in the of the new being that, for example, car teary, you could destroy some things if you try to change them, right, Only professionals who know how to do it. So that's how you should think when you are creating programs in object oriented way. There's only a lesson, Thank you very much.
35. Encapsulation: Hello, my friend. Today I will tell you about encapsulation and I will show you it on example. So before we go into the definition, let's get it from the context. So we have in the class called bank account and well, every bank account has got to balance. So that's great. And now let's create bank account. So bank account, it's going to a you buying to come. So we have got a bank account and now wow, let's become reach. As you can see now, we are very rich as it one more zero. So we are going to be more for each. As you can see, it's that idea that you allow people from outside to change the balance. That is well, for as made. It wouldn't be so bad. Bob eats bed idea, right? You should make variables almost always private when they had private, they cannot be accessed from other classes, yoke and actors than only now from within the class. The variable was created because, you know Hey, hey, I you know, OK, I'm not going to change the balance in the more, but it would be good idea if I could check how much money I have. Then you have to create a matter inside the class and got these bombers have to do it. Well, let's call it end, Get violence. So we say that we're gonna return in, Teacher. So the balance we say that we want to get it, and this thing is called getter. Get there are used to get private members off your properties of your class outside. Right. For example here. So now you can do a that get balance. And as you can see, it works. Fine. Now we're poor. Oh, let's give hours of a gift. Let's create constructor on. Let's do something like that's a sign of balance. $101,000. Okay, now we have got something on our car. Okay, So, uh, now we created a bank account. Now we can get the balance, but we cannot change. So that's why you also want to create sometimes vory bows that are private, because you can show it to other people, but you know cannot change. Well, what would happen if I want to deposit something? If I wanted to withdraw something from my bank account, Okay, then you should create a matter for doing. Let's create something. Would we win called setter? Set bottles will not return anything. I think we should take the number. They want to set our balance. Those of, for example, number here, right or amount? And let's set balance, too. M o that was sent. OK, but the problem is now did we can again to something like balance on sent You dig around in a game we are reached. But here is the difference I can make here tells off conditions. Okay, I can check if that's the right guy. If yeah, he's able to do it. But, Barbara, but you can do whatever you want. You okay? That's the difference between the solution that we head before when it wasn't private. Okay, so it's very important to use to make setters because you need to anyway, sad things. But you can make conditions now. Okay, let's create now, I method that we allow you to withdraw something from your account. So let's call it with Joe. So it's self descriptive, and the amount will be sent that mattered. And now we are just going to do something like balance. Minors equals amount. Andi. Okay, So we have got at the beginning. 1000. Let's with zero. For example, 100. It works. Fine. But what will happen if I did something like that? We withdraw, we do more than we have given our bank account. Right? So it's not good. We should first check if our customer has good enough money. So if violence of the camp is bigger than the amount he wants to take from, then you can do it. Otherwise, Hey, something is wrong. We'll return falls, for example. So let's change the type off the method. That right, that well, we need to return something If everything is all right, so return through. We can type return through here, or we can have it inside if statement. But the truth is that if that condition is not mad, right, if if else instruction is not around these one and we'll just return truth, Um, it's gonna look like that. Okay, so, no, As you can see, it's still 1000. So as you can see, it's school because we can make conditions and there can be thousands of conditions like that, and now and you don't need to repeat them. right. You can now, for example, do something like if everything when fine like that, then sent to the output. Okay. Otherwise, note enough money. As you can see, we have not enough planets. So the money wasn't taken. Okay, But there is one more thing. Why did we do something like that when we have got a set balance method here, we could read type stuff like that said balance. And now the current balance minus amounted, was sent here. Everything. You work the same when we typed the normal number like that, you can see. But you know, now we are using the script that has been already written here. Okay, We can use the conditions that were here on. I'm in other things that could be here. Remember, the methods are really created so you can reuse them, right? Maybe this was very easy instruction because he's reassigning here and here it was on the subsection. Or maybe adding something. This is easy, but you know this simple example This can become very many things to do. So try to use your methods. And now you can also make this private. And you can know we've dro using this method on through the window and only if you check for example conditions here. Right? You don't need toe allow to set bonds outside. We've all providing money, Right? Um, while providing money which should work for deposit. Right? Sorry. When we created the poles, it in the mind. Now we can deposit, for example Said violence balance plus amount. Right? And we turn that to so let's stuff like a deposit. So I'm adding Kwame thousands of 500 because you can see it's working fine. So deposit is now using this method here inside and so you don't need toe. Repeat some things that would be inside here, right? And the cool Think also about this is that we have good our program now in parts in models . You can exactly see that head. These method is for depositing world amount. Okay, here I'm sitting the balance, and I'm just sending any balance here. Okay, return through. It means that if everything going fine, OK, now it makes sense when you look at it. I know that when you are looking at this and you are new to object oriented programming, you might be like, really Why did it make it looking so bad? I could just do everything. You Allah? Yes, you can. You code. But it would be horrible if you made everything in one line if you worked with other people . When you are working with other people, you want to create things, dad way. So it's easy to communicate with other people. So one person can work in one part. The second on another part. When you're writing things in line, right, the fast cold, then this is the way you would provide the program on the on your own. And really, this is also the solution. Dr. Oriented programming is not the only way to program, but that's how java is constructed. So Java is a language youth for working with other people for creating called that will be easy to ready to maintain other things I did. There is lots of ah, lots off coat that will be added because of that. But this is how you ride in job, okay? And this is the solution for creating applications to creating become prominent. That's why there is money most time. But if you want to create something fast, very simple then Jonah my maybe not be good for you. Right? Then you can use for example, fight O. C. Because you want to write something, Father will be war. Right? But if you want to, you know, understand everything and you want to work of other people. You have to know all the syntax. How does everything how everything here works so you can create things on your own, right? Okay. That song did lesson. Thank you very much.
36. References: Hello, my friend. Today I will tell you what is the difference between references, variables and primitive variables. What world out reference Very with other things like that. So the first thing that we should focus on is what is a primitive variable? A primitive variable is just a typical verbal like integer like floor double character reference. Very both are classed ivory. So when you create a class, for example like that, you can start here Many values, right? And they're this class like vory both. So when you do something like that, tests has new test. It means that I've just created a very bold That is a reference why I will tell you soon white school directly. But before we go to it, I like to remind you what's going on when you are creating a typical primitive variable. When you type and you say, Hey, I want to reserve 32 bytes in the mirror and I want to access this memory by using, for example, ex labour. Okay, now I would like to a saying to that place in the memory and volume, for example 50. And now we have got there under the label we can access 50. Okay, pretties. And now when you get another variable, for example why and then assigned to it peaks. And then I change y to something goes for example 10 and I sent to the art. But now, for example, X you will not things that eggs is still 50. Why? Because the y variable is really a coping and new. You just assigned here 15 right in deadline and then you change it to 10. That's all. You change this value, but here is the problem. Let's assign here, for example, 20 tothis cane he didn't than under very books a week. Do not confuse ourselves. And now let's create test What's going on when you type this, it means that you are reserving in the memorial in the random access memory at place and your sign that address to that we're able. You do not assign value. You assign address. Okay, there's the difference. So that's why it's called reference variable because you breath refer to the place in the memory. Okay, this is address, you know, if it was value, it would be hard to start more than one value, right? You can have a plant of our value, um, men and otherwise other things like that. And you cannot store all these things in one place, right? You have got here. Indeed. Variable now a reference. So we have got you an address to things like that. And no, when we do something like test And what when we create another test, for example, tests on and we call it, uh, that's do. And we assigned to its test what will happen when you do stuff like that. That's do A And I was signed to it, for example 50. Now, when I sent to the art test today you're notice that it's 15. Maybe let's change here. It's this to 30 or comment this section so we're not confused. As you can see, it's 50. Why? Because here in these lines, I am assigning and address. So the truth is that test and test, too, is really pointing to the same place in memory. This test is a reference to test, too. It's I, you know, calling a dog, um, baby and calling and dark role fright. I can call him both names on. If he knows both of them, he will reacted the same thing, right? Right. Now we ascent here again. I'm telling you this and address. That's why when you change the value A you really change it. Like if you did it that way. Okay, This and this will give you the same results. Um, balm the same results. And that's how all referenced variables are working, but one that makes even more confusions. Well, look, we have got the string Guest and string is really not a primitive type, but this is a reference variety. When you create the string and for example, name are kaddish. And then you create string name, too. And you assigned to eat name. What will happen when you do something like that? Name too equals, for example. Uh, veal, right. What would happen when I sent it out? Put name. Well, Steve are Cardiff. But you just tell me so many things like that and I'm confused some hard right now. It's only because string is special. Why? Because most people these beginners not know about things like that. They try to hide references from begging earth. And this is the thing that happens here. The two of is that you are reserving here. Mm. But it is not shown to you, right? It's done in the background behind the scene. When you compile it, As you can see, the result is the same, right? We change name to Viola. And, well, it didn't affect the name one. Because you are reserving here now. A new space in memory. And you you tied there. You that place in the mama Marie will be pointing toe the place where these value will be start. Okay, Our country. So that's how it work. And you might like Why did they do it? Well, because string itself often used and it Z, you know, they wanted to make it feel like it was a primitive type. Almost. There is another thing that we need to talk about and we talk about in next lessons. But hey, that's why they did it. So if you are confused about this section right now, do not worry. You just need to remember that strength are almost like primitive types. OK, you you When? When you just a sign something to the string. You do not change. They are almost like cope. Fight. Okay, But this is very important how this work because it can let too many problems that I will talking. And in the next lesson, that's only the lesson. Thank you very much.
37. References passing: Hello, my friend. In order to understand these lesson, you have towards the last lesson. Let's see what will happen if we create a class. Let's call it test. And now let's create here Ever able I and assigned to it, for example 10. And now this create mattered that will not return anything so void. And that's called it change value. And here we'll take, for example, of a Rabel. And we'll change these variable so the same variable, but will add to it, for example, for what will happen when I create test. And now, when I change the value like that and then I check what is the value now? As you can see, it's still 10. Why? Because, as I said in the last lesson, when you're creating something like that, a typical primitive variable, we know that the value under the A label is done, and it's like, Hey, I've just sent you 10 and this is a parlor matter, and the parameter is like saying, hey lets the same to its 10. Okay, it would be like saying something like that. So we're creating. We're compiling. We're creating a new variable. We're sending Q 10 and then we assigned to variable 10 plus five. And now it's 15. And now, then after this Carl abrasive here is dilated. They don't. These were able dies. This parameter dies. Okay, Here. No. Well, when he displaced from from here. So actually, we didn't change the a here, right? If you wanted to change it, you have to make something like that. You need to return at the end. The result. And it's still not gonna change it. But you can assign the result, Devorah Able that was sent. And now with Shane, right, Because it's signed a new value. Okay, so let's change it back because I want to show you something. What would happen when I create another class, for example, called food and I creating it volume full. And now what? Let's make it X. And now let's create this fool so full, full equals near food. And I want to change this fool using this class. Okay, change. Cool. And I would take it here. So food we're able and I want to get into it and change takes to, for example, the eggs that it was there plus 50. So let's the same you 10. So when I sent and this year the food that we created here because, Well, the new is really reserving the memory, right? The address is the assigned to this. A reference? Very. But because it refers to the address you're using the constructor, that these default. So you're not doing anything but constructing it. You're reserving the place, and you are also initializing the value. So you're assigning the extent. And now when we do stuff like test that change food and sent full there when I do something like full that eggs and send it to doubt, Put like that, you'll notice that it's 25. We change the value off the object, right? And why? Because again, when I do something like that is like saying full equals. The variable here equals that food was sent. And here was Watson address. So a sign here Odd. Okay, it's copy off these address, right, Because we have good now a new parameter. But it's still the same address, still the same. So we are pointing to the same thing. We're making, um, change on the same thing. That's why when I type something like that, I'm really changing these guy here, right? It was created here because I am not changing an address, but I'm changing the thing that is under that others. And that's the difference between this and this beef. You send a string and please do It doesn't exercise. It will act as primitive values, OK, because string is different. It is used very often. And they created it like that. So it doesn't make confusion, I think makes more confusion. Okay, there's only dead lesson. Thank you very much.
38. Comparing Strings: Hello, my friend. In order to understand this lesson, police watch to lessen backwards okay is very important. So what happens if you want to comfort to strength when you create a string with the name, for example are cut and then you create another stream Move name too with the labelling toe and I were assigned to it also our Kardashian, when I do something like that name isn aimed equal to link to. Then let's send to output they are equal and that you can see they are equal But well, it always between you know, because value here and value here can be sent from other place Right now this thing is called later. It means that it's literally place if you I just place you these characters. And when computers sees a situation like that Hey, is our cover Is that covered? Why would don't we use the same space in memory for them? It's good optimization. I right. Why would I start them under two different places? Right. Okay, so that's the same to the name the same address in turn into the same others. That's why when we do comparison like that, we have got something like they are equal. But if if right these values will be taken from another place whatever it could make here and take me state because it would compare really that this is comparing addresses. Okay, so Eve, you, for example, created using this method you will not This they are not cool. They are not equal, right. That's because here is another s and he was another other remembered These a reference were able still is the reference were able. And when you check it like that, we're going to see here that they are not equal because addresses are different now because exactly say, hey, reserve the nuclear said reserve a memory for the reserve for a memorial for this without this because our computer date Compu later is very in Regent. He wants to make opt immunizations. It will put it in the under the same place Dead swine. It's very important to compare in situations like that. Well, using the method is called equals. Okay, the name has well, the string object has got a method that is called equals and it checks if two strings are equal. And then we are comparing really the values of strings. Okay, No Dad dresses, but values. So right now there are equal. And also, if I do it that way day we're been equal. I know it makes lots of confusion because I told you so many things about the reference. Very good. Bust strings are just different if you do not want to, you know, think about for a long time. And I remember that when you're comparing two strings, you need to use this method instead off the equal science that the thing you have to remember and you have to remember that when you're sending strength, uh, when you're complying string assigning things and other things, they are working the same as primitive values. The during the lesson. Thank you very much.
39. Bottle: Hello. Let's exercise it beat. Because if you go to fuss, we gonna forget about a few important things that strain. Okay, let's create a class that we because bottle and we will be able to fill this bottle, we will be able tow poor apart the water out of the bottle and will be able to transfer the water from one bottle toe another bottle. Okay, So how to do it? Well, first, we need to create a very bold that will represent water. Amount of water, Right. So let's create, for example, double amount or just water amount, right? Something like that. And, well, it's double because we can use fractional numbers are here, right. And we're going to use thes class because why? Why should we care? Kate? Another cross we don't need to hear is a closet we can use. This is the main static method which exists all the time so we can create in its this class , right? This is just a method that the exits always and it doesn't matter. You can create insight of this class in that method, this object. So let's create the boat bottle so we can do it. like that. But let's create more than one how to create more than one. Well, the best way to do it is to create an area, right? So we don't need toe. Every time creates another vary. But we want more. We just need to increase the size. So let's create an airway. So we have to use these bracket brackets. And now let's it qualities, for example, bottle and now new bottle and, for example, free of them. And now this is very important. When you do something like that, you're reserving the place for these bottles, right? For this type, but by default, all bottles, we have the no value. What does it mean? It means that it's really something like that. Okay. And why I'm saying this is because right now, you know, now that this is a reference, right? No means that you refer to nothing. There is no others that we refer to. You have to first create each guy using the constructed. So a new bottle like that. Okay, let's cup it now like that. And now we created using this constructor each object. Okay, you can do use it. Do it in. Look And this is your exercise. Do it? Didn't look, if you have problems, just ask. And now let's create a constructor for it. So there is a starting amount right of water. So let's create a constructor that we called Bottle. And that sender, for example, water amount, right water amount and let's assign water amount. The water amounted would be sent here. And as you can see, we have got a narrow here. Why? We just added any constructor. It's because that if you create a constructor that wasn't default. Constructor, you delete the default constructor, you have to create it, even if it's gonna be empty. You have to create in, you know. OK, but if you're not gonna use it, then it's OK. You can just send here amounts and everything is gonna work. Fine. Okay, It's working up, but we've out sending going to think here, it's gonna give you problems. Okay, so we just created free both bottles with 10 5 and one liters inside leaders. Right? And to pour out something from the bottle. Okay, The water. So let's create unlettered will not return anything. Let's call it feel and it will take double water in my own. So, Khalid what they're and this water amount, we want to add the amount that was sent you. Now, let's sculpted because pouring out will be very similar. It will look like that, right? And now we can do something like that. Total of one. Feel a mom, for example. Five liters and let's send it to the output. So, um well, we should call these variable private, so we keep encapsulation and let's create a method that will be able to get water amount so it get her right and we're gonna return the water amount. So from a bottle, what was the euro? And now get water amount. That's when the project, as you can see, it's 50. So added five liters even use that format it We're gonna deal it five meters. Okay, Let's now create a method that will transfer what's right. Transfer water, and we need to know how much we're going to transfer and to wear wound to transfer so to another boat bottle. Right. So we need to take another bottle here as an argument, right. We need to create the para matter bottle on. Let's call you for example. Transfer Teoh the bottle. And now we want to. We want to feel well, We don't. We want to first take from the bottle We want to pour from. So there is that Andi. Now we want Teoh for the amount of sent here and then we want to send to the transfer to bottle. Um, transfer What? We want to invoke field. Want to fill it by them? And that was part right? So we can use these methods Would do something like that, right? We don't need toe again, right? Discovered and discovered. I know that this code in this code is very small about Hello, Weaken. Do some conditions that we need to do some Look what? Right now we can, for example, transfer water and let's transfer, for example, amount 10 5 the the bottle that will be bottle one. This you can see now. We lost in bottle on the first, the first index and the index zero. The first element, right? We lost five liters, but we added to the second guy five liters. So we have good 5 10 Okay. The problem is what we've happened. If I do something that is you can see Well, our bottles are bottlenecks, right? You can take against Majesty won't water. That's no good. So you have to make conditions right? You have to do stuff like that. If the amount of water that we have good right now is lower than the amount that we want to take, then we cannot do it. So if it's bigger than you can do it otherwise is not perceived. So now it didn't work. These pouring out but feeling work, right? So we should somehow inform these instruction that this instruction was wrong. So we should now return your bowling and do something like that Otherwise return. False are returned. True. Always right. We turned through if everything here went fine, right? If that condition was not met as condition so it's gonna return through. So here. Now we can check if this thing worked then execute this right now. Nothing worked, right? Right. Right now you can say something like else The amount Waas Teoh much. There is not enough water. There is not enough water to transfer. So that's how you do right? You could also return here false through and then return. It's here and then check here. But the truth is that there is another method to do it even better. It's called exceptions, and we'll talk about in the special sections. And now I'd like you to train a bit more. I like it to create here. Another property dead will represent the amount the capacity of both. Right, because right now we can put as much water is around in the bottle. And I would like you to, you know, check in the film at it here. We didn't exceed the capacity, and I would like to also, you know, but it was in the same time. Check it here. Right? That's why we are using these methods care. So we don't need to check two times conditions here and here. The same conditions. So let's do it as an exercise. And also, I like you to change these into initialization with, for example, for a loop. Okay, that's going dead. Listen, thank you very much.
40. Inheritance: Hello Today I will tell you about inheritance inheritance. In real live lives like that you have good, for example parents and you inherit from them some characteristics. For example. You encourage from them the color of the i. U in a hurry from them, how old you are and so on, right, you get it. That's pretty easy. And in programming, it's the same. For example, when you want to create again, you have got monsters in the game, right? Monsters. And there can be many types of Mont sisters, for example, from this skeletons and many albums, right? But you get and look when you look at monsters, zombies and scallions, all of them have got, for example, hit points, right? They all of them have cuticles. Okay, all of them can attack. So the in carrot or hit points, all of them can attack. So they have got some habits from their parent. So every everyone have, for example, this pit they move right. There are many things that will be very similar to them, right? So now imagine that you write like 100 line of codes called a baby free 100 line of code in zombie and kill it scaler skill at home. And now imagine that you want to change something that we affect In points are taxes and speed. You have to know change in, discuss and discuss. Okay. What have you had? 50 monsters. You would have to changing 50 places This thing Horrible. That's why you have got something. What? This girl's inheritance. You can create a monster and you can create zombie and zombie will extent it will inherit franks from monster. OK, and that's what his inheritance. And at the same time, you know why you want two years inheritance something? Okay, so we don't know what this inheritance have to use it. Let's create in your pocket because I want to show you later how protected keyboard also is gonna work. But not in this lesson. But it would be in future lessons. So let's create a new package and we carry on our monsters on Let's create a new class that we called moster and you class that we recall skillet skillet on ah Scots carried And also Okay, Zumbi, I won't breaks. Yeah, Okay, so we just created free classes, right? Let's now define monster. So monster. Every monster has hit points, double hit points. Every monster has got some kind of spit. Every monster can heat so they can fuck looking. So let's create the most of him. Monster monster equals new and now when I click control space enter, you'll notice that I D. E. Net beans is including is importing from the another package the monster. Okay, that's very cool. If I didn't import it, as you can see, it's not working, okay, because he's in another package. So we just important this bucket on you can use it because Bob Public, if it wasn't public, I couldn't use it right. And now we have got now are monster. And when I think that as you can see, I can't attack, I can't use anything. That's because these things are not public. So let's make them public. I know that I am not encapsulating things like things here, but we're not fork accusing encapsulation this lesson. You can encapsulate it so you can just do it private, private, and do getters and setters etcetera do it on your own. But because you can train right that Zizi in this lesson, I would like to show you how inheritance works. Okay, so But we need to be able to use to, you know, involved attack, and check if something changed key points or speak. Okay, so we just created again Art admitted. That allows us to add excellence. I am attacking from monster class. So let's imagine that here is scraped that attacks people. Also many people other most of Okay, let's ladylike monster that at sec. Okay, it's working fine, right? You have got on the one class? No. And now with created public constructor Ah, public monster. So we can invoke it on. Let's create a special monster instructor Constructor that will have to it points on spit. And now with this kit, points equals hit points. And these that's spit equals spit. Okay, so now we can create a monster with some variables. It starts. So he will have How much Pete points for example, 100 hit points and speed off them. Okay, on now we can send this output monster that hit points and monster dot That's Pete. It is easy, right? We just created a normal class. But now the magic happens. I want to create this kill it on. And now if we did not have something good to sculpt inheritance, I would need to type everything from here because it would look almost seeming Are here again. And imagine that inheritance inheritance. It's like, Hey, let's copy days till here. Okay, so we're just gonna type extends monster class. Okay, It's almost the same. Like we had complied it great, isn't it? Now, when you create here and met it, whatever you will not is that we have good access using this to hit points, to speak, to attack. So it's really like if we had all these methods and properties here inside, right? You can of course, say something like, I don't want you to have, for example, a tractor, right? Something that then these that in these you can see you don't have active stop. It's not possible to use it in a more. Okay. So you can change how things work using, for example, private pontificator. But if you do not do it, then everything is just here. Okay, So how can we use this information? Because hey of skill, it only can be a bit different. You can, for example, move faster and so on, and he cannot talk a bit different way. How to do it. Let's create a skillet on as you can see it imported here automatically. And let's, for example, use the ataque. What do you happen? As you can see, I'm attacking from the monster class. All right, on Dwell. What do you happen? A. Now, when we do something like that, I am construct er from monster class. I am constructed from mostly class. We've two arguments. As you can seem. Well, we have got now here I'm constructed from most across with two arguments. It's from here, and I am attacking from monster class. It's from here. Let's get under the comments so it would not confuse us. Now you can see I'm constructive from monster Cross here, right? So it means that when you are creating a skilled home, you really are invoking first this constructor, because let's think a second. You cannot do anything in the skillet on without having most surfers, right, you have to first create base for skilled Um, that's why monster is called here. A base class. It's sometimes called super class, or sometimes it's called parent class and this class. That skillet home is called right now something like, um child class. But maybe that's going that like base. So these derived class on and these guys stopped us. Okay? The one that encouraged something that extends most and well what will happen if now I use no the default constructed? Because when I'm missing default, constructor, everything is working. Fine. But when I sent here, for example, I want to have more hit points and faster speed. No, it's not working. Why? Because if you are not using the default constructor, it's not created now, right? We have to now create the constructor that this default and you have to you create the constructor for skillet on that will take arguments like here. So we need to create Para matters like that now when we involved, it's working. Fine. But there is a small problem. What do you happen when we sent to the output? Scared don't hit bones, is it 1000 Note Zero. Why? Because that is the default value off points and speed, right? It's because this thing was involved. And as you can see, I'm constructive from monster class. And then I am attacking from most across. It means that Oh, of course, that's something like that. I am constructor from scared of class with two arguments, and here I am construct er from SCIRI tone class default, maybe de fold constructive. The easier to see which one is. I am default construct. This is a conceit, says I am default. Constructed from Monster Cross. The default constructor is always invoked. If we didn't specify which one has to be involved, okay. And if you want to change the behavior because we invoke the default, one end with two arguments, but we didn't use these arguments will need to now do something like this. Get points equals eight points and is that speed called speed? And then, well, it's working. But it's not good idea to do something like that, because I really do. You want to repeat everything that's here. It will be great if I could somehow get from here to hear and execute everything from here . I know this is on the two lines, but remember, there can be many conditions that can be many other things, so you can do it. Using something will discuss. Super Super is a key world that allows you to get to the super cast of the base class of the parent class. Right? So super. And then you execute. We've something like, parent is is the constructor up you. But when you use it like that, we were invoking the one with no argument. Right, Because you didn't send you an argument. So nothing changes here. But you can invoke this one, right? Sending kid points and sending spit. Okay. And now he's working for And this is a good solution because you are using We're using the code that has already been written. Okay, that's very important. That's how you should write. That's how you should create things. Okay, so now you can, you know, change something. For example, Sprink type off a talk, right? And you can, for example, create another constructor and you can take your strength type. Oh, attack. And here you can involve that method up top on days. Dark type of attack equals type of attack that was sent you. And now you can young create the skillet. Um, like that. Or you can created like we've for example, ball right. You can do things like that skillet until on Dwell the you can, for example, here you can by default set type of the attack two, for example, box right, that starts to make sense, right? You can make some changes in the scared on because it's not the same monster, but some things are very similar. So why to repeat? And, of course, you can do the same things in Zombie rightly extends the monsters monster, and then you can just go on. You can try to do something fun here as an exercise. That's only good lesson. Thank you very much.
41. Polymorphism: Hello. In the last lesson, we learned about inheritance and we created the skeletons. Don't be monster. But what if I wanted to, for example, attack as this carrot on? Or don't be a bit different way what then? Well, you should somehow involved the attack method from here. You know that. You know, do the script and normally is done on in the same time. It will be good if I could, for example, create something for my own use is right. Because here is the type of attack, something different, right? So how to do it? Well, you are just going to tide the same things that are here. So we can just stop it and face it here. Not the border, but that same signature. Okay? And not when you combine the same signature here. As you can see here is and hey, hey at over. What? Right and notation notation when you use it, you are. I think, something like that. This is in the notation on when you click on it, you're gonna jump to the over reading method. Okay, so it it's like from now I am our tag method from Scaletta on. Uh huh? When you do something like Scalito on attack you're not. Is that Here? Is I am attack from skeleton crossed. We invoked on Lee this method using this Carita. Okay, if you want to invoke things that were here, if there were many instructions that are important for you, then you gonna type stuff like super that and then invoke, for example, attack. Right, Because you're invoking now the method from here. And as you can see now we're invoking both not first from the most across and then from the skeleton cross. So that's how over riding looks like ive you, for example, past here. Something new. So, for example, the type of attacks of string type off attack this is no more an overriding. Okay, As you can see, it stays removed. He said notation Because this is overloading off method because right now it's like, Hey, you have been dismantled. Comm piety because of inheritance and this method, it's overloaded by this matter, OK, because they have good, different parameters. And when you execute the one we've out arguments sent here even notice that we are invoking the one from the monster craft Eve you sent you an argument, right? It's of course, gonna involved A won the argument, but it's very important to understand that the difference. Okay, so this is called over riding. But what is a poorly more fees? Okay, let's delete all these things from him. Let's create a monster like that and let's create a zombie on. Let's create Skari tone. How many names do you see here? Men, Right? Polly from Greek means men. Morpheus means form. Right now you can do something like that with the single form, you can take many other forms. Okay? It's gonna work. You can easily assigned to the parent child. You can't decide chided toe the child parent. But you can assign to the parent a child clock object, right? You can. You can point refer to something that and that's very useful you might like. But why? Because you can create the metal, whatever. And then you can create monster moster, bomb, bomb, bomb. And now you can send to dis met it right? You can later decide Like this is the way we need to create instant of inheritance. But you could send here. No. You can also make it stuck make it studied would be able to do so. We can access now in hair returns and do stuff like whatever and sender, for example, news capital, right. You can send it here pretty easy. No, you can send their zone. You can send the spire, you can sender the wolf. You can send their whatever you want. And you can have only one method for all the things that stick right thing. Then you can check bodies that met What is the class? And you can do whatever you want on the on the thing. And that's the cool thing about also pulling morphine, right? Because one single thing you can access, man and also poorly more fees is looking a bit different when you want invoke method. Because look, right now we created something that but what would happen if we do, for example, something like that? No. When we do something like that, what would happen when we do and a park you would not, is that, um it's very important when you are reserving the memory. You are invoking the constructor from what? From the derivative class. Then from the base last right. And that's why you can assign really monster here because hey here is also a monster. He was Morrison moster and Skill skeleton skeleton, but they are both here. That's why you consigned here. But when you do em that attack, as you can see, it's invoking both methods also. But it's only because we did something like that. When I do it like that, you would notice that we have good actors, only to dismantle. We cannot now from here, actors. Somehow that monster, the method from monster. OK, you can Onley access the one from the scary at these air. For now, it's also very important that you have good access to it only because we created and method like that in here and here. If you had another method for Grant okayed void test, you will notice that when I do so like and that you can access test and Mom, as you can see, it's gonna be invoked what we happen if I shake, like, totally delete it from the monster and create a new matters here. As you can see, it's not working anymore. There is a good thing to know, right? So it's really very following because when it doesn't like am that you have got really access toe Onley things from monster. OK, cross. But because here you assigned the reference to the Scalito. When you look at Skari tone, you override because he over read and there's met it using this object, you could somehow invoke this attack method. And this is called Ossa Polymorphic. Okay, well, police, more fees means that it's like an ability. Often object to take money. Take oh, man informs ability to off something to do many things. Okay, because poorly means manner and more physical means the form, right? If you do not understand what, this pulling more friends, it doesn't matter, right? They don't need to know what is promoting exactly Because you're just gonna program. You just need to know how to use it. And the most important for you to know is that when you are sending here something right, you can send pretty easy this carry down here bomb and you can access it using something like that. You can change these behavior if you want to, for example And if you wanted for example, somehow actors this test you you could change this behavior by doing something good is called down Casting. You could do something like that test. Um, sorry. No test. We could take that I m and now we could hate That's downcast. Downcast it down. Right. That's cosy. Down to the skill Tom Skerritt on. And now, as you can see, when we just stuff like that dot I can access this. It's because right now I am saying the this IHS you know, ask skeletal. It's really as carried on. That's how you can access things from skeleton. And we are saying that we know what we are doing, right. If there is nothing here like that, you can only access as you can see the methods that our properties that are in the most across, but not the properties and other things that are enduring with class unless they are over reading right? That's the difference, because they are also in the monster costs. And somehow there is a magic behind a poem. All fears that may that allows you to use the attack method, for example here. Okay. Does Linda listen thank you very much.
42. Protected modificator: Hello Today I would tell you about protected bald if, Equator. Before we go into this topic, we gonna make some kind of rehearsal on the public. The normal modification later, the default one ride and private. So when this is public, right, like right now, it means that this act this variables accessible everywhere. So we can do something like from another package and that and I can access it, right? I can access it in every possible class that enquiries and other cars and someone, right? It's just you can access it everywhere. When you deal it the public, it means that it is. It has got that package actus modification er by default. What does it mean? It means that well, you can access it now. He right, you can day, it's that and you can active speeding hit points. The problem is that you cannot access it now, for example, here clinically dot and you cannot access it. Maybe it's a good idea to do. Cannot access it from another for pocket, right, because somebody could getting to things there and do something very wrong. But what if I created, for example, tell monsters and I would like to allow somebody to create other moster outside of my packages. What? When we create another package now, here and what, sir? No, the package. But I wanted to create a class. So, for example, are created Spider and I want to I want to import you first and the monsters Then I want to import from there. Well, a monster. And let's extend monster stones. And now this. Create whatever function. And now there's this stuff like this that, as you can see, I can access attack. All right, but the candle doctors days because this has good package. Pontificator in this class is here. And that's when you want to use the protected Keeper. Because if he was the product of QR, it means that you can access it even if it's in another park. It okay? You cannot access it from, you know, here I am that but you can act. Is it from the class that in Harry's that extends the class that set one off the property or one of the method to protect it? If you said this to private, you will not be able to access it. Animal Raidi will not the actors toe activity here in the skin carry tone, but you will be able to access in their closet that the property was created in and what? That's how it should be done. But you should create it, create always at least protected. Get for example, hit points, right, something like that, and then return hit points, and this allows you off course returns double to at least you know the stuff ideas that and you can get hit part right. You should create also the setters so we could do something like this, then set hit points on Do You could set it from another pocket, but there could be some special conditions in it, right? It could make special conditions to check if everything is OK, right, if it's a really good idea to allow this guy to change something like that. So said heat points in close to the hit points that will be sent here double eight points. Andi now hit points. This hit points hit points that are sent here. Oh, I am returning something. I don't need to return, I think in the center this that said, he points and I can set he points out, but only to using a matter. Right? And I can use this method because it's protected. But the cool thing now is that when I just don't like em that as you can see, I cannot set it from here, right from the from the classical inheritance. I can do it to the class that knows something about moster, Not to the cask class like that one that doesn't know anything about it. Okay, that's something. That lesson. Thank you very much.
43. Abstract classes and methods: Hello Do they were going to talk about abstract methods and absurd classes. But before we go into this topic, let's think a second. What thus abstract world mean in my humble opinion, it's like something that is very hard to determine, to evaluate right, something very hard to imagine, and well, in our situation, something like that exists from the programs that were creating cried, for example. It's monster. We can we somehow describe the monster. Can he say how he looks, how he would any made other things like that? It's really not possible to do something like that because we cannot imagine it, because only there's all case killers Kallat on the zombie. Okay, I can imagine it's by there. OK, But these one? No. And that's when you can say that this is abstract cloth. But from now on, you cannot create the instance off the monster class. So when you do something like that equals new and now monster, as you can see, it's not working right. It's not gonna work. You cannot create. Now the object. Okay, you can, as you can see, create this skeleton so you can create a, um you know, you can declare the M object that the type this monster and you can assign to eat for examples carried on. But you cannot, you know, reserve memory for jobs. Monster. Right? And now you might be like, but really do any to care about something like that. Well, there are many advantages because of the up circus, because right now you can create something with this cult. Abstract methods inside abstract glass. So how do they look like? Well, you can type something like that abstract Now the time will be returned and, for example, it can create description off the months. As you can see, the abstract metal cannot have the bolt, and it's great you know how to describe this monster. It's not perceived right. Okay, so let's just type you abstract. It's impossible to describe something to this abstract, so this is not abstract. But the cool thing is, now that we have got here everywhere hours now, I have to implement all abstract methods when I Kriegel need. As you can see now it implemented it automatically so it over ride did it right. The cool thing is that now this is required aim the classes that will extend the monster. And that's awesome. Why it's so awesome. The things like that, Why it's so cool. We'll talk about throw later. The design bleeding it. What it's something like that is so cool because look, there may be many times when you create a class and you might think this method is very important. Ah, it must be implemented in the classes that will extend my class right. And because of something like that abstract keywords, you can make sure that somebody will use it, right, Because you can forget about one off the matter. You could create here many matters and you are not required to override them, right? But because of the absurd keyword, everybody who extends it must do something like over right and you can probably not, is that it's not gonna work. Why? Because Spider is in the inheritance packet and the UFO Robonaut is that this is the default. There is a different modification that this cold pocket modification and well, we need to now say that it's protected, are going to say that it's Publico came otherwise is it will not work. So now we can implement it here. Okay, so like that. And we also need to change here the signature. So to add protected here on, we also need to, uh, do it here. Okay, you can change protected to probably. Okay, you can change it to the new modification, er, but this new modification her must be more accessible than the one that was said before. Okay, you cannot, you know, satellite private now. It will not work, right? You can see it's not working. When in the public. It's gonna work, but it's It needs to give bigger access. Okay, So the Absar class allows you to do things like requirements for the classes that would implement that would extend the basically as the supercars, the parent. Right. And it still keeps the functionality off. Being able to send, for example, their Children's Children. Teoh mattered right like that. I can see since your scary, scary toned zombie, despite the other things like that. Okay, that's going the lesson. Thank you very much.
44. Instanceof: hello Today I would tell you about the keyboard is called Instance off. But before we go into the skillet, I like to show it it on the practical example. So we train a bit classes. Okay, that's imagine a situation that we want to create a person a student on, for example, and employees. Okay, so let's create a class that we present the person and, well, the person has good always, for example, name and, for example, the sermon, right? That's something that person always have, but will when we create, for example, and playing, he can have also something for this called salary. Right? How much money here and when creators star student, he can have whatever one. Well, he doesn't have money at work because I'm joking. Um, whatever. You can create something here. I'm just showing you the sending something. Now let's extend Well, not this guy, but this guy by person and these guy by the person and well, the first thing that you probably already have noticed is that creating person is just nosing because we cannot describe him. Right? So it's good idea to say that this is abstract class. Okay of course I should created in new clouds and clouds new classes better than because it's easier to maintain coat. But when I'm creating a cars in creating a lesson like that now, it's just easier for us to keep everything in one fight. So it is here to see what's what are relations between all these classes, right? So and this is the super class disease soup crosses right that extends person. And now let's, for example, do something like, Hey, I would like to have a description. So let's greet the method that we'll get description off each guy. Okay? And, well, we cannot describe person, so it's good idea to work, too. Make it abstract. And because of it, we have to implement it in both places here on we have to implemented here. Okay, so I implemented it here and here and now. We can, for example, send to the output information about the employer employee. Right? I am employed. Any were saying, um, for example name. We can access your name because, well, as you can see, we are extending the qasab also have access to all these things, right? I remind you. So what did I say, I think that name surname and we can of course, do something. This salary right edition on property with the seller and with the same thing goes for this guy. But he is a student on. And now let's well create, for example, persons of person person equals. Now we can do something like that, right? Because, well, these obstacles But these can still allow us to create. For example, right, we can create student and signed the person because this is a reference create the that is created by constructor off Discuss starting from with the's guy right on. And we should create a constructive use. Um, you know, science fell out of names on them and so on. So public employees Onda, we need what's drink names, stream star name on. We also need salary so stir and it's not stringing double Sofala. So there's that name equals name on SAR name equals Suning and these that solid equals saw . And now you have probably noticed that I am making a mistake. If I copied this thing here and I do something like that, where do we have a mystic program means that, but it's not the dye invoked here. The problem is that over right here, as you can see there on the way, Rose, The problem is about development on your application. I am repeating coherent here. Right? So it's good idea to create a constructor here, right? Person, constructor and person That will take what? That you take the street name and string Sound name right on. Did you sainted these name, name and this surnamed song And because of it now we can we can do something super and send the name on suddenly right We do not need toe Repeat some instruction. Okay, now it's 10 times, but And as you could provide the noughties when we know to something like that employees now I always say our card views What are chick Now Let's say I would like to as much as thes is working. Right. Um and you have probably not this, that it's gonna invoke this constructor, but it's invoking. Also constructed from top circus. Yes, it's gonna invoke it And when I create instance of it But you cannot directing directly, you know, do something like that new of personal. You cannot do something like that but to the class that is gonna extend. You can do something like that. Easy. Okay, so now we have with the person. But we re create person. One person to person, free for student, for another employee, and so on. No, it's bad idea. It's good idea to now do something like and Ari, Right, And Harry off people. So let's do something that people a sign. New person. And, for example, for people, for people. Right. And now you may be like, Hey, by you. Do you use the nuclear work here? Yes, I used it. So what? I am really reserving the spacing memory. And this pacing mama right now is for each element like that. No, no, no, no. Right. The people off zero is really no off one. No. So I didn't use the constructor director, right? Thes one I just reserved, um, and some variable did will later refer. Refer to something someplace right to the others. If you don't under understand it, please go to the lesson about references versus very. But it is very, very important lesson. So Ah, right now we can do what we can do something like by poor people. off zero dot on we can access name and starting a description. Everything right when you do stuff like that, um, it's not working because right now we do. We didn't assign any thinking people off one that, and we can, for example, so about that dissent, like new per node person. But new employees, something like that. Onda we gonna sent here to Lang Suning and my big salad bar. Let's increase even more so yeah, now it's to this year. Now he's working right? And, well, let's create another guy and let's make it a student student doesn't have celery and something different like that so we can get access to the description of both guys now, right? That ondas you can see The cool thing is that we are using one name and this is the policeman. More fees, right? We're using one name. We are using one name off method on. We get different results because we executed this method and this method Ah ah! The magic happens behind the scene on and it works like this Very, very cool. So Ah, now I would like to show you the instance off key, but what we would happen if I wanted to show all people for him. As you can see here, it's good idea to use a loop. So when I use a low so let's make a group that will stop execution after we go to all the elements. So if I do something like people off Hi that get description description. Not things that I printed these two guys. But then I have got exception and error. I have to fix it because, well, I'm trying to access here at the fact that people off zero people off one and then two and free and two and three is really what? No, no, right. We inserted here employees and here student. So here is an address. Here's another reason we can get the get description from there, but from know from nothing, it's not possible. So we can check if the guy we go to the guy would check is instance off the Carson cause Okay, if yes, then we can show description. As you can see now we don't have and but when you do something like that, you're not, is that it's still executes after you know there are news. If I do something like that? They do execute even more time. We can use, for example, something like that. Otherwise break. So we do know blues time, right? That's why if something like break, it's pretty awesome. Okay, so that's how instance Office working. It's checking if the thing here it's an instance off the class here. No. Is not instance off anything Rights of it was just falls on. This thing was involved, but its employees instance off person. Yes. Why? Because when you are invoking this constructor here, you really are invoking. Go. So the constructor off the class that you that you are extending, right? So you are invoking the super class constructive. So it means that you are really also instance off that cost above you, right? So that's why days we returned through. And that's how you can solve some problems like that. When you go to Manny object, you can check if they are instance off some kind. Of course, right. You can also what's very cool? Something like that. And then you show now only employees. Wow. And now you're gonna show on students fight of the problems that we had to break you so And now we're gonna share a show on this student. So maybe kids would be better to use the counting, right? I don't want to end. We want to continue, but Well, there was nothing. No other instruction is here, so it wouldn't give us and the bomb bomb bonus. Right. But isn't it girl? We can now, if we had more classes, right? Imagine that. Did was, for example, Okay, monster here. Minimum type of monsters, right? You could just get feeling that I only monsters that are the Teibel like that. Pretty awesome. Okay, that's kinda lesson. Thank you very much.
45. Downcasting: Hello. In the last lesson, we learned about the instance off Key word. And you have rubber notice is very cool because you can check exactly if that object here is an instance off object here. But there is a problem because we all the time involved a method that is over reading from the abstract class. But this is no real life example. There will be many times when you have something like, for example, special method that we call, for example work. And, you know, he are gonna be some instructions that, well, you know, make some work. Okay, We're just gonna send something to doubt, but And now you will notice that we cannot act. Is this method Why? Because you need to know that right now we are really having Q A type off person, right? So we can access Onley things that are called like here we could act is the get description from here, but it only it only happened because the signature was here. Okay, so if I want toe active somehow, the class that is done, we need to do something with this cult down casting okay in to get down. Because these things. One is the highest in the hierarchy, right? And now we can do something people we can now do down, casting, employing. And now we still not have access to it because we need to have a parent is at and this into something that and now we can act as the war. As you can see now we can see a message I'm working. So it's working fine and, you know, But when we delete this condition, as you can see, once it worked because, well, he would have an employee. But then we have got the student. That's why it's very important to check condition like that. And you're probably like how it happens that the computer is not checking if there is a narrow because your computer, when he says something like that, he believes you did. You know what you are doing. He believes you that, you know, you are probably using it on the right class, right? I don't know yet. Let's run this program and this thing that checking if the connection is good. If the binding is good, it's called late being binding. Okay. And now, as you can see, ah When I check something, everything works fine. The it believes us, but well, it might make a problem if you don't understand how things like that work out, right. So you need to remember toe make a condition to check if it's really employees because of, you know, check for example for student. Well, it's gonna be wrong if you check for example for person still gonna be wrong because person doesn't have dismounted right on Lee, the employee thinking So this is done casting. And if you did not like how it looks like right, you could do something like, for example, you can write people off I and you can down cause it's so we can use them. I want two down causes to employing, right, and we can create temporary employees. And now we can, for example, as you can see, involved the work matter. There's a needed lesson. Thank you very much.
46. Object class - equals: Hello Today I will tell you about class that is killed. Object? Yes, that's too. There is a closet is called object. When you do something like that, you notice that you can do it When I click on it With control, I can navigate to this object that can read about method inside of it. There is a class later so you can use everything from the clock from the class because you inherited everything from this class, right? There are methods for me. As you can see, it created a classical point. It's for a simple just can get this point created part, right? And well, you do not need toe especially extend by object because all possible classes in your applications and off them and created by another people the developers, all of them will encourage from object. So you do stuff like point p new points. And now you, for example, created point like that. And now when you do something like three dot as you can see, you can access not on the methods that we created, so that this too. But you can also access metal like that. Like that. Like that, right? You have met it. You can active. That's access one of them. So, for example, we don't get crossed. What will be the result off it that you can see? It's just the name of the clouds in the pocket, right. So you can get additional information about the point, for example. And there are other methods like, for example, because which is very important for checking if one object is equal to another object. Because you have to remember I remind you that if you create for example, another object I don't on DWI, for example, make a comparison lie for example, that if b equals to pity and then I say they are equal. That's a good Nazis. They are not good because he was one in 10 500. But what if they are equal? They are still not equal. Why? Because I remind you that here and here I have the address. And here I have been different address because the truth is that the new keyword is reserving an address and you keep reference to the Tabrizi, right? These a reference were able the type is referenced type right, And here also So these two objects did not know about each other. So when I am comparing like like that, I'm comparing two different addresses. So it's very important that if you want to compare two objects, you should get create a special metal that this called equals and you can override thinks from, for example, object, right, So you can do something like that. And now here you can return, for example through. So we need that we always through. And now it's when you invoked quotes. So when you do, something equals on descend there, Peter. It will be off course to If you now return him false, it is gonna be forced. Now you decide what's gonna be falls lower world's gonna be true. So a I think in our situation that we need to compare x and y So let's make a comfort reason. So if there this object So that p here is this right now that X he quotes to the object of the sent here. So they wonder this sent here is this one right? Who if the old is now we have get the problem? I don't have actors did the X and y why? I hope that you want the video about the down casting? Because when you create something like objects and you now do something like that, you need to remember that you don't have access. Do the methods to the properties off the child you can refer, refer to. But you don't have access to things that if you want to have actors, then you have to make something good is called down casting. All right, You have to make sure that you can do so. You can create, for example, point B, and now you can cast so you can do something like that point now. Ah, like that. And now, as you can see, I can get get access to get the eggs and good wine. I still can't get access to these, but it's because it's private. Okay, So Ah, you have to make what you have to first into something like that. You have to take that all you have to make down casting. You can, for example, uh, sand pond assigning to the very so then it's gonna be there, too. So sent point that and we compare that X right, and if they are equal, I want to return to. We know that when you compare to values, it's gonna return true or false. So right now on the two off the values first values must be equal and it's gonna be OK. The second is not gonna be check how to check two things at once. Well, you have to use the conjunction. So it's very important to know that there are other operators, right? It was very crucial to learn things like operators before going into object oriented program. So if you didn't do it, so go back. Otherwise well, you can keep going. And now we can check using the contraction with checks in the same time to conditions that can check ive in the same time. This that why equals to send point that why? Right? And now we're going to check puffball. So both Ah, I mean both gardening. Sorry. And now they are equal, right? Isn't that awesome? Now he'll get a special method that can check if something is equal or no. And, you know, it's very important to do stuff like that because now you decide how a comparison is working right, because you know, when you create the person you want to compare, for example? No, I know the salary. Or maybe their name. It's up to you. What is gonna make it too? Oh, no. But now it's also very important. Teoh, You know, mag bulletproof? Because most time you gonna do things like, for example, like that object and points on you gonna create, for example point for example, for point. And now you would do something like points of zero in crawls. New point on Now, for example, apart. Right now, you something like that, Andi, I want to free and, for example, values that's changed them a bit. Um, Harry required, but not officer, Of course, here is should be awry. And now it works. Fine. Right. But if you're comparing something like that, um, let's make it a bit smaller when you're comparing something like that. So if you do something like that p off zero and now is a d call to for example, pay off one. Let's check comparision. Okay, that's something like that on that's sent to the output. If it's true or not, As he concedes, too, right? If I change something off course for But what if I send here, for example, something like that by mistake. But it's wrong. So I should check Keith. The object that is being sent here is not equal to two, right? If yes, please return false. No ah, object equals in new. Well, it's not working, but it's because we have got here an exception, and I write in the example Bones exception. We try talk to something that was not creates the wing to something. Do something like that. And now, as you can see, it's false. Um and, um because people four people five year off six is no right. If I did something like that, I was trying toe access here, something that doesn't exist. A doll there is not even know right? That's why we had the problem like that. So now it's false. So without this condition, we would have still a problem. Okay, so we sold one of the problems. But there can be other problems like, for example, let's imagine to do have a 0.3 dimensional point and you want to compare them or somebody sent here an object that is not the same object, right? There are no the same classes. So we can check if this doctor get class is not equal to Ajijic to get to cause if they are not equal, we can return instantly. Falls right on. We could also speed up a bit. It's just additional thing you can do. For example, we can check if this if the object that we are trying to compare So that one has good The same address Yes, the object is being sent here then returned through at the start. Right? So it means if you would do something like that we compare sing I It means it's true. So that's how you do things properly Because you cannot hear now also override of notation for example So no, see that it's over. Return on Dwell. That's how you do it, right? Because of it, you can compare your own objects. You think special method to it and you know you could create your own matted colleague What everyone But the cool thing about this is that that you everybody knows that equals is used for comparision, right? And later if they want to compare toe objects, they know that you have probably implemented something like that. Okay, so it's almost like a convention. Okay, there's only the lesson. Thank you very much.
47. toString: Hello. In the last lesson, we learned about the object class, and there is one more method that I would like to tell you about. This method is called to string it is. Taking the name to the streak means that hate when I something that, as you can see, we can see here a string object cause that point. So is the name of the class and the packages in and some kind off something with this called Hash Out? Okay, I felt something generated jobs for the purpose of this craft. And well, we can see it's working, but it's not giving us good information. We can exactly create and information. We give us more more information. So in order to do it, we just need to what again? Override it so we can do something like that on Beacon Given ad notation over right, right, And now we need to return the strength. We will return here, whatever it will be always. The result was something that beyond zero p one p two free, right? But we can now do something he like that get X plus, for example, get why, well, it's good idea toe at the space, for example, like that, you could say, did its exit is why whatever that's gonna see Now it's four and 55. So now it's very cool, because when you want, for example, using the loop get to all the objects going you can send to the output, the information, the description like that you can see it's not working part of course key with no. So we could should check if it's incense. Ah, what if be off I this instance off and part and though it's gonna look fine, right? So it's very cool because you do not need toe especially involved and method that is going on, you know, get the eggs get why we didn't need to use the down casting here also right in order to invoke the good geeks and God, Why? Because this method exists everywhere, not only here it exists in the object in exists ever were, so you can easily at least the bark. For example, your code. Give some information about your options that's going to lessen. Thank you very much.
48. Final keyword: Hello Today I will tell you about the final Kim port. As the name suggests, Final means lost last time that you do something with. For example, look of a rebel. When you create a double pie and you assigned to eat 3.14 you will not be able to change this party later. Okay, so this is how it works for the local variety variables. Okay, You cannot change the value. So it is good idea toe created for, for example, constant values. But this is really rather rare situation. Let's find, for example, a situation that this more real life example we have Bettina an officer class person and a class called employees that extends that person. And you know, employees has got something going to sculpt. Eight off employment, right? He asked. That's too. So let's create a date of employment. So this should be, I think, created using the great class. Let's import it. So I kicked the counterpart counterpart space, an important it. And there is also another way of important contra shipped with I and you can see, then you can import. All classes were not imported. And now let's, for example, called date off employment. And I think it should be final because you know, you can string date of employment. If somebody was employed for years ago, that's history, and you cannot change it, right? As you can see, it's not working now, because when you are declaring something like that like a property as a final, it means that you have to set it in the same line or in the constructor. Here it's OK. You can change it, for example, here, right toe free point for 14. And but you cannot change it later. Okay? So once you can do it. Because when at the beginning it was not said, But later you have to remember about you can, um, do something like that. You can use the constructor. And I think this is more relied Example when you do something like that, Okay, New date. Why? I think it's better idea because well, when you run your program, don't have an object, right? And all these objects will be created. Really? Ah, using for example, database. You will just create many objects and sender data from example from database Right on. That's how it should be done. So we should have also something like that, right? The constructor like that. And do something like like that. So if it created employing, you would notice that we cannot change now, a date of employment. You can see like that. It's just not working right. You can send it to the output. No, but you cannot change it. Okay, that's gonna see It's very cool because you can see what's inside, and they okay, so this kind of work on properties. But how does it work in classes? Well, the first thing we with me, for example, deleted knob circular and sent final. As you can see, you cannot just extend it. Okay, so final closet closet decanters extent, and you will probably never use it because it's very right situation. You want to make a class final if you really do not want somebody extended and the situation like that can happen, For example, when you have some very secure things inside, right, Like these up example, authentication, passwords and other things like that. And you might be worried that somebody extend your class and do something wrong with it, something that will be horrible, OK? And it's very very, very rock, and it is good to know that you cannot create in the same time. Finally, Absar Cross because you know, upset cars means it should be later extended. But so this is just stupid to have them next to each other. OK, so that's how obstacles work. I mean, final classwork. And now let's see how the final method works. So if you create, for example, other class programmer on, do you extend the employing? So when you create, for example, and method here that we because get date off a employment on do you return the state of employment, right? And you, for example, something either clear you can override. But when you city to final, you cannot have arrived in them. All right, It's just not cannot combine and the same situation like for the class. If you think that this method, because with some very secure things that you don't want toe be used by other classes, then you can use the final keyboard. Okay, Some people say there is a performance increase in Cremin. Maybe in some, you know, John Avital machines, but you shouldn't even care about things like that, because if it even is speed, abs. It's so small amount that you shouldn't be even worrying about it. So use it only if you think that you do not want somebody toe Do something like, you know, overriding your method in the class that extends something. Okay. There's only situation where you should use the final cure for matter. So most time you will use it only for property. That's going the lesson. Thank you very much.
49. What are interfaces?: Hello, my friend. Today I will tell you what our interfaces interface is very similar to class, but eat has got a big different properties and methods inside of it. And if method that you create insight and interface is gonna be public and abstract and and property created, insight interface is gonna be public final and static. So when you create an enterprise and you do it that way, you type interface than the name of interface. Anything you create here, well behaved like I've just said Right. So if you create, for example, double pie and you assigned to eat 3.14 this thing is really public final and static, so you cannot change it, right? That means final static. It means that you can get to it using something like that, right? Using the name off interface and public, it means that it will be even accessible in other packages. Right? So name of Internet, very spy. We can get through it and send it to the out. Right. So these is default more difficult. Er's that you do not need toe at here, right? You can do it, but you cannot change it, right? It was, it was Just use that you just need to know that they are like that. You should know that you cannot type your public interface because this interface was created Insight class that was called main in the main dot jar Java. If you want to have interface that this public, you have to create a special far if I called name of interface, that job. Okay, so you can have only one public cars or one public interface in one fight. So that's how the property work. And now let's create, for example, and that it like that and this method is by default public and abstract. So this sample met. It has to be over reading in the causes that we implement interface. What does implement world means? It means that you want to take after all behaviors from the interface. It is very similar to extending to incur reading. But implementing this word means that you want to take behaviors. Okay, So how something behaves because the purpose off creating interfaces is normally because you want to have some kind off requirements off behaviour for other classes. For example, I have good right now a monitor in front of me. You have got it also. And look at this. You can turn off this morning. Total towing monitor. You can also turn on it. You can change the brightness and other things like that. And it's not by mistake called interface, right? There's something between your face and on its interface. Write something between your face and this bonito. Right? Is this thing on this thing is really a behavior, right. The implementation of these behavior is gonna be different for each monitor, right? The girls, you know, there can be different ways of doing things like that. We don't know exactly. For example, when you look at the monitor that is called bank you O R g, how do they do it? You know, inside of the monitor that you turn it off or on bro Bobl. It's almost the same because it just kept it secret. But, you know, we don't know where and exactly it happens. Other things like that. And so but the behavior is almost always the same. Rights s so so so so. You can, for example, create an interface. Dead will just make every monitor that implements and interface like that. Teoh do things that are required because, as you can see, we're not implementing. We're not creating the behavior inside he right, Because we cannot is an abstract met it. So if you create a class, for example, employing you can now implement. So to use a new key word, for example, name of interface. And this means that I have to implement all abstract meant it. As you can see, this was the abstract method by default, right? We didn't need to add these modifications so that that's how it works. There are, of course, many more better examples. Are you sure you want very cool about sorting objects in the next lesson? But right now I like toe show you also the difference between interface and an absolute because you might be now like, hey, you know, in absolute class, I also could create a public up, segmented and probably final study things and other like properties. Are there things like that? Right. So why even bother creating interfaces? Because you can implement more than one behavior more than one interface so you can create another interface. Some other interface right on You can just lose something like that, right? Coma And it will get work. And it's pretty, you know, logical, because you can have to. You sometimes want to have many behaviors from many interfaces, right? Oh, you condone interfaces can group these behaviors. Meanwhile, the name right, So So So So you can get them and more than one. But you cannot extent. So we'll be great. For example, class programmer You can extend, for example, employing right body if you create another class, for example A You cannot do something like that. You cannot extend more than one class. Okay, so that's also a big difference. And in interface, every method is public and upset and every properties public final started in absolute class. You can implement something right here. You cannot do it at all on dwell Here is once similarity. So when you create, for example, have a Rabel like that, you cannot create of course instance of it right? You can see try to do something like that. This thing is called anonymous costs, which means that you are creating it in line without their name. Anonymous one and it implemented dissented for right now these useless but as you can see you cannot create an instance. Ah, off this interface. So why even bother creating a type of a rebel like that? Because you can refer the same way like you would For example, do in when you do something like that object, object, Be right. You can do something like new employees and here you could do new employees. So the super class, the one that is in the highest place in high rocking can refer to the one that extends it. And also, when you implement like here, when we implemented name of interface, we can do the same thing for interfaces on then off course, you cannot access every possible met it that you can see. We can actor sample that Onley because some police here and it's here in the same time. But if you create another method, So, for example, gets, um, salary on then, As you can see, you cannot access it right. You have to first world, you have to first do something go disco down casting. So you have to do something like that. And then yes, you can get salary off course we should create it. Que, for example a salary like that. Right on where we should create also public contractor employees. Ah, double Soleri This that salary because Okay, on now, of course, Going to he was not the default constructors to create, for example, salary for this guy. And as you can see, um, it's not working. I don't know why exactly. Oh, so you when we extend employing, we have to create also a constructor for programmers public, for example. Programmer, Um, we have to do something like double salary and linked to send it to the constructor up top , for example of going to implement it on our own so that I did okay. So as you can see, the behavior here is very similar, like for classes regularly for up circles. But there are many differences between after class and interface like, for example, that not that in interface, every properties like that and every method is like that on and on. You can implement more than one behavior, okay, and interfaces, remember when you want to create interfaces most time want toe created, So it's like a requirement for behavior for some class. Okay, They don't did. Listen, thank you very much.
50. sorting using interfaces: Hello. In the last lesson I told you about interfaces in this lesson, I will tell you how to use interfaces on practical example. So we created in the last lesson class employees and class programmer. And now imagine the situation when you want to, for example, create a programmer okaying, for example while many programmers so like that and now we gonna create a few of them. So like that you programmer will send it a salaried er in something like that. Ah, for example, like that. And now I would like to sort it how to salt programmers By seller, you could create your own method for sorting. But really, creating something like that is like invading, inventing again a wheel when you have got really matters that are gonna do it for you. You have got something with this golden arise cloth. When I used the counter Chef shift Plus I shall cut. As you can see, we imported it. And now you have good access here to manage ment. It's you have got here a matador, this cult sort and it is overloaded many times because you can send their different values . As you can see you can send their characters doubles float and, well, four, they're in TJ for short. That other types that you can see here there are already implemented interfaces. Well, there is already implemented that one interface that is called comparable that allows this method to sort. Thinks because certain mint, it is just not gonna work without implementation of comparable. When I sent here Now, P, as you can see our program is not gonna work is because you can see this. I think really needs an implementation off this comparable Think, right. I mean, comparable interface. So we have to implement it first. But before we go into it, let's see if the thing that I say is true. So when I do something I, for example, that new anti germ free into Joe's on I'd something I Mm hmm. For example, like that. And now when I do something like dead right, what would happen if I do like it? No. This will have to take under the comment. As you can see, um no, sir. 12 The 1st 1 is minus 51. Because this is sorted ascending way. So it's going from down to the high rise to the highest value. So as you can see, minus 55 then it's five. Then it's 50. So this method can be used to sort in toujours because there was already implemented Comparable. So these like a requirement for sorting. Right? As I said, interfaces are in requirement. So even implement, for example now comparable. Okay, As you can see it say's instantly that we need to implements. Sorry, Comparable. We need to implement all abstract methods and this method here is called comfort too. We can go to comparable interfaces. You can see it just looks like that, right? There is an inter for face with just one met it. So now we have to implement it the way it should be implemented the way the behavior should book When we go to the documentation, you can go there by doing separated, right? Think And now then click shift Altos If one or a gun show job documentation you get this. Thank you came And when you go down as you can see here we have good description off method comfort too and how you should implement it. So the comp Aries is comparision will be good for your object because you know, right now we can, for example, so these things are sending way by salary, but there can be many different situations. For example, what if you wanted to sort by not salary but for example, by the name and surname other things like that, right? It really depends on situation. So that's that's why we are here for deciding how to implement this behavior exactly for our employees, right? The behavior is to compare for these matted assortment is the requirement that this method requires for comparision. Right? I hope you get in there. So we have do not implement it. And we can, for example, return here. Zero. At least now it's working right. We could t o like that. You can see right now, at least it's not. It invoked this so we don't have a good a narrow. So we can, for example, to something like p off Zero is going to see get salary. We can get this salary. It's OK, but well, it's not sorting because we returned here zero, which means that everything is equal for the sold metal. What do I mean? You have to implement behavior the way it was intended to work. You can see it say's compares this object with the specified object for order returns a negative anti jer zero or a positive in teacher as this object is less them it cool to or greater Dan the specified object, the one that will be comfort. So we can, for example, do something like that. Be off zero that comparative and you can send their for example, p off one. So we sent You can see using the's object. We use the method to sender p of one. We can send it because here is an object, right, we can access subject object can refer tow n impossible calf because this is a super class for every possible calf but in order to get to values to methods because right now, as you can see, we don't have access to met its like, for example, salary, they things like that we have to first do down casting, right. So we have to do something like that. Onda. We can, for example, like that. So now, as you can see, we have access to this. Okay, that's great. So now we can type something like temporary and we can get to salary. And this is pretty cool because you can use that method or days because we are inside the class mine that these employees Okay, there's I on. And now we can compare this object. So if these that celery is lower than the one that was sent here, I should return. What? And then we go to the place where it will be described described how this behavior should work. We should return negative integer if this object is less than the one that is being compared so we should return minus one. Otherwise, if it's bigger, then we gonna return. What? Then we go on our return positive. If it is greater so we can return positive number. If it's equal, just gonna be zero. You have to remember that returning means that this is the last instruction invoked. So the truth is that we don't need to use Asif and it can look like that, right? If these captains and it's gonna return this happened, is going to return to the place where it was involved, right, otherwise is gonna beat these. And now, as you can see, we have got your minus one because ah, Oh, let's come in this because we salt it first, right? It's one because 10,000 is bigger than 2000. And this method, the result of this method, is being used in this mattered somewhere. Somebody implemented the result off these meant it And thats why this requirement discussed so cool, right? Because it is now required for comparision for, for example, things like that. And now when you do thinks like that, like sorting as you can say, it's minus one because we change all the positions of things. Let's send it to the up. So let's, for example, programmer and, for example, to send my programmer that gets salary so before comparision it looks like that the way we created. But after come after Comme Parisians, after sorting using this comparision, you think our mattered It looks like that 17,000. So we started it ascending way. If you want to change this behavior, you send another government here from the using the collections class and use here the static as you can see static, matted reverse order. And now it's gonna sorted this descending Great so from the top to from the highest salary today. Smaller size, right? Like that. So that's how you use interfaces created by other people. As you can see, it is school. Because if no this implementation, we wouldn't know how we should implement the behavior needed for this mattered, for example. Right. Okay, well, that's all in the lesson. Thank you very much.
51. Nested class: Hello Today I will tell you about nested classes and I will also tell you what's the difference between static class and inner cross. In the next lesson will try to make something that would represent the usage of nested classes. In this lesson will focus on, you know, things that are a bit boring, but you have tow understand first before going to something practical. Okay, so let's create a class. Let's go it, for example A. And let's create second cars that will called there and, as you can see discussed is inside discuss. That's why it only exists on Lee within this cost. What does it mean? It means that if you create, for example, a constructor that we call a And with something like that, I am from outer class A and we'll kick create a constructor Here I am from I am from inner class to be when you do something like a temporada in you Okay, you will not. Is that on Lee? The outer constructor was invoked. You have to know invoke manually This constructor you under to create this graph, right? Okay, So discusses called inner class because it's inside its internal class off. And now we should think about the level of artists between both day scuff. If you create a private variable example temporary here, let's see if you can access it from from example this constructor. As you can see, it's possible so in their class because it exists within cafe can have access to death things to the properties of the methods. If you created here mattered, you would have acted street from inside Discuss from being However you create here private , for example we were able did will call double sample You will not this that we do not have actors to there properties of intercourse Even if we made them properly pickers, it doesn't matter. We do not have access to them how to remember something like that? You know we are humans and we cannot actus I don't my heart, for example. Right, But heart is working and somehow accessing, you know, blood are things from outside, right? Um maybe did it stupid how I try I try to relate this how to connect this, you know, and remember it. But something like that, when you think stupidly you start to remember things, right? Okay, so you cannot access something that doesn't exist. You right? That's also the reason when you created this, you can see here I am from outer exiles. You didn't create the inner class. God, you didn't construct things right. You have to first construct everything inside. So in order to construct it, you can do it, for example, from another cost. We could, you know, do something like that. Be being you. Be right. And then you have access to the sample. Okay, Then it's possible they're looking So no, let's see how to create Discussed not from here. Because from here it was pretty easy, as you can see how to create it. For example Here, Clause B. It's called nested class, you know, class. And it means that you cannot, you know, created without first creating these guns we've already created constructed the outer class using the constructor here. Now we need to use this object in order to create the inner class. And that's the syntax. And now we have to save it some. The reef we have to create the re friends were able the reference variable should look like that. So as you can see uh, these variable que have actors now? Two. It is good that the re friends Now to this object I decorated with this constructor here. And this is the same tax you know that you use in order to somehow get what we could just I think outer. So it would be easier to remember, Right? Okay. And now let's talk about static cloth static class, if you, for example, did something like that. As you can see, we have got a few errors now because study Clough is right now on Lee nested class. It means that it is inside. It's nested inside the class, but it's not in our car. It doesn't exist within the closet because it can exist even if you do not create an object of crazy. Ok, that's the main difference. So as you can see, we have got here on their own because right now we can do it a bit different with we can go into ad, then we can going to be And we can involve the constructor love so we can do something like that and we can save it, for example here. Okay, so now you can access it here because you know, the static cars can itself is static thing. It can exist even toe We didn't create there. Outer class subject. OK, that's the main difference. And it also means that you cannot act. Is now from here, as you can see, Variables outside right in the outer crust. Why? Because how can you be sure, Dad? Something like class a object was created, right? This thing can exist without this object, does it? Hey, you do not have actors to it because my note exist. So that's why you cannot doctors, you know. And it also means that you can finally create here, for example, static variables so you can create static double by because 5.40 if we did not have it. As you can see, you cannot create static variables because static variables should exist. Always even toe. You wouldn't have created the class a object. But you know, class A its outer class right now this is in her class and you have to create there outer class object in order to create create the inner close off. Jake. No, Right. Without the static, more difficult. Er arrived. We've started modification or you do not have. Okay, so that's the difference. So let's create for examples another class stop D plus c. Okay, so it means that you can have static doubled high, for example inside. Like, what is the difference? And well, here we are creating things like that. But see, Consecrated like that, right? Ah, see, seriously a Then let's go to see because outer cross and then we go to class. That is nested. And this is called nested class and inner class. This class is called nested. It cannot be called inner class, because how can you call something like that and inner cloth when it doesn't need to? Well, when it doesn't need in order to exist the outer cross. Okay, it is just message just inside of it. Okay, that's only did lesson next lesson. I will show you some practical example using these nested cars because right now you might be like Whoa, really so much pain for nothing. Drizzling the lesson. Thank you.
52. nested practical: hello today. Are we showing a bit more practical? Example off inner classes. Look, we have got here a bank account and that has good in account balance. And every bank account has good. Something will discuss interest, which calculates how much you gonna gain money if you have got your money on the account for a bit longer time. So there's the interest interests, right? And you might like Okay, So let's create a class that will represent interest And let's put there, for example, think that will calculate for thes bank account the calm balance and other things like that . Well, we could put it in another fight, but it would be hard to connect these two guys right, And it would just take time. And it would just make no sense because creating the interest class we've all bank account class is not a good idea, right? So if there is a situation like that, the thing that it's not good idea to create the class outside of because you're creating, you think that you're not gonna extend it, that's and so on. Then it's probably a good idea to create an inner class. Okay, so the inner class is used for grouping, right for making things that are related to Jadot. They're easier to maintain. So let's create inside of it a class that we will call interest terrorists. Okay. And we will create the private Vrabel that will be called interest. Right. So let's create, you know, constructors and other things like that. I like to show the d views counter plus space you can generate, for example, the constructor for the properties that we've been already created that you can see it's pretty far. I can off course also create the getter. So it's also very cool and the same for here, so we can create this on this. I think it really improves this Pete of creation of class for the simple things that happens a lot of time. So first thing to create properties, and then you can create very fast constructors or getters using something like that. Okay, on. So we have gotten our class interest the lousy to get the interest rate on Dhere, we have got the bank account can be created that's created bank account, So bank account, commune, bank account, and we can send the account balance at the start, for example, for $1000 and now we can get to the bank account on and, for example, get account balance to see how much money we have get there. So, as you can see, it's working. And now imagine that we want toe calculate the interest right? Came. So, you know, let's create a method that will be involved by somebody else each month, for example. So let's Kate emitted that with the public void, and we call it calculate interest. And here we need somebody to send the interest rate right, So double interest. Right? So we want to calculate an interest right here. So we have to first create these instance of class for interest. So, like that, so we can access interest rate from side, right? What did I do wrong? Off course. We have to send the interest rate, sir, because we don't have the default constructor created right? We have to use the one that we create. Okay, so now we can go get interest rate from there, or we can calculate the interest rate inside this matter, right? So we can, for example, create a method public change account balance. All right. Something like that voice. And we will change the count balance using the interest rate that's been sent here. So double interest. Great. So we can know get did big bank account, though, because this class is really a class the can access outer properties. Right? So we can do something like, um, where is this combines? So we can get the account balance and at the interest. So maybe it's first count it. So double interest equals and the other two candidates, we have to take the account balance and multiplied by the interests. Right? And we have not divided by 100 because we need percentages. So we have to divide, for example, in 55 sent here by 100 then we have good the percentage, right, Because percentage it is really a number divided by 100 person means dividing something by one. No, he would have interest that we can. Now it's to the account balance. Okay, so we cannot change the counterbalance using this. Ah, so now we can do interest that change account balance and send our the interests right, sir. Well, we don't need to use this year right Because you can use the far greater created this private variable here. So Y, since two times the same thing would be just horrible. OK, so change Calm balance. Ah, and now Well, it should walk right? It complies. So now we can bank account that calculate interest on you Consent, For example. Five parts of the percentages on and you can see it's 101,050 five personally multiplied by 1000 is 5 50 50 to 1000 This one 150. Andi, you can just for regional this method, right? So you can, for example, being vogue each mom for something like that. Then then you can see how the interest rate affects the I can't bother. So you might be like Maybe it's looking worse than normally, right? Because when you are new to syntax like that, it might be height hard toe understood that you want to group things so badly from the object oriented perspective. These is the way you should do it. Owner, if you think that this cards really is only related to this class on and it has total and no sense outside of the scope, right and it's so this is really very row around situation where you want toe do something like that most time on. So so do not worry if you do not understand things that are happening here. And it is good to know also that you can create something with this cult local inner crosses. You can just cut these on. Do you can pays it now, for example, inside here. Ni that Okay? And now, as you can see, this closing is inside this matter that school, right? So we have good the cloth inside and let it and this class will be created just for the sake of this mattered we sent here. The interest rate is considers interest rate is also here. But this parameter is on leave able here between this and this place for things that are not inside calf. Right. So this parameter is the look of available for things here. But you can add something good is called the final key word here and things Now you do not need do things like sending um, using the interest right like that, because interest rate with the final key word here, he's available everywhere inside the class also. Okay, though, there's a difference. No, I know that you might be very confused right now because most time you do know, do things like that. And I think that this thing doesn't like good. Okay. For more complicated classes for simple cars where you have to do something very fast, it might be OK. And then you will use most time. Something will discuss anonymous cross that we will talk about in the next lesson. Okay, so this I haven't really written a cold like that because, Well, it's just good to know the Centex you know was going on. Ive you some. They have a chance to see a code like that. This way they do. I created it before. Yeah, it's gonna happen. Did you see a cold like that? The inner class off the class. But this looking like that, I think it makes more. It makes it more. It makes it harder to understand harder to read, right? So I think that you should avoid it. I just showed you eat. So you know, the syntax and the possibility of doing things like that. Okay, there's only the lesson. Thank you very much.
53. anonymous classes: Hello Today I will tell you what are anonymous classes and I will show you the purpose off using them. Anonymous grass is, as the name suggests, a cloth without the name. So when you look at something like that at first you're like, really, why would I need a class without name when the class poor purpose is to describe properties , matters and other things like that, Right. So maybe somebody can reuse that class, right? But there is a purpose for anonymous classes. For example, let's imagine a situation like, let's create an interface Dead will, for example, based something like action after click. Okay. And here we will. I want somebody to implement action. And now let's create a closeted will kill baton. And now I would like to, you know, implement action after click and then implement all abstract methods. And now we can, you know, involved dissection. So action from back in one. And now you want to create another button, you have to create another class. This is not good, right? Well, you could probably do the big different way. For example, you could extend right so bought in to extents baton and then you would need to override this for these guys, right? Hey, in order to make the action different from these bottom, right? And, you know, situation like that that you have more than one button in the application. Because when you know this, all things are buttons really right is very often, and you would need to create a class for each possible button just for the action. When you look at this situation like that, you are like, wow, really? That's why for we were we have got the better solution a solution with the anonymous classes. Let's create, for example, action after click. And now, as you can see normally, you cannot do something like action after Creek. It created it for us. Something like that, right, Because you cannot create an instance off interface. But as you can see, when I did something like that and I used the counter plus space it generated for us here the lockout, the anonymous class without the name as you can see, he would have got here only curly braces. So we have got here inside of it. Just the action, just the thing that should be done. After clicking So the behavior right? What should happen? We can now start it here. And we can send it later to, for example, that clause, but still no, we can do it rather a bit different with We do not need toe employment it here. We just need to create a clause bottle and, for example, creating method at action. And here we will take action after click. Okay. And we can invoke here the action that will be placed here. I am action from anonymous most class because, as you can see now, using this, we can easily, as you can see, actors the action, right? So we can access these mattered here. It's because, as I said, interfaces that are implemented by a class can refer to the class right. And here we're not referring to the interface, right? You are referring to that animal Scots that we don't have named toe. You can of course, you create properties you can create here and other matters, right? This is not a problem. You can create with it here, whatever you want. But this is not the purpose of this anonymous crap. Okay? The purpose of these analyst cars is just to do something very fast. Just implement the action. And now the cool thing is that I can create a bottom, right. And you know, you can great here some properties like we've and so on the hide and whatever, and I can implement the action. Just sending this right. So this is the behavior that should be done after creaking it. As you can see, I'm action from anonymous class. So this is the action that was involved. Of course, this mattered here, right? Should be invoked after somebody creaking something. But we do not know how to implement evens or something like that right now. But that's how it does. The is useful now because now you can create another button, right? Be to you. Do not need to extend every time, the bottom for another button. You just create a new variable for another button with new properties, for example, high with and so on. And then you just you know, at action and you want new action for these guys. So you don't even need to do it that way so that into store direction, you can just, you know, do something like that. Hey, I want these action looking like that on and, you know, let's send here I am action films class for botany, too, right? In this case, he's working right? So you are just adding action to be done for this button when somebody Creegan is so you know. But of course, these methods should be invoked after creaking. So as you can see, it's very useful, right? You are not making somebody create every time new cars just for the behavior. So this is very powerful a c on That's how it's done. I created here in the comment a java swing When you want toe implement in action, you have got something with this cult J battle. This is a class that has got things like that, right? The bottom. And it has got a method like that at Action Listener and you are sending their and on the most cause that implements actually, anything that right which says that the what behavior should be, um, you know, implemented would be what you should do when the action is being performed for the button. The action performed is really just creek, right? So when somebody quick just perform things that are down here. So we did the same thing here, but, well, we created this girl in our own. So that's how you use and then discusses. And this is the practical usage for it. That's going the lesson, Thank you very much.
54. Aggregation: Hello Today. I would tell you about the aggregation. Aggregation means connection means addition. Okay, this is the meaning of this world. And imagine a situation like that. We have got an employee. And now this employing has got the name right. But this employee has good. Also, something will discolored and address. And now let's imagine an Andress, right? So, for example, you are, say, and then the name off the street. And then, for example, the number and other things like that. As you can see here, if you properties that I think should not be defined in one string because later you wouldn't be ableto extracted, right? You wouldn't be able tow Qari Teoh to make sound kind off operations on them because you it would be hard to, for example, change the order because he wouldn't know which one is wage on the border there in other things like that. So this is the place for creating a new cloth on aggregation. In addition, class A connection. Okay, so we are going to clear create an address class. Okay, So we are going to implement now, create class addresses. You can see like that. So we're keeping the class address. And now we're going to have the street name my we gonna create. For example, Street number on a string, for example, Countering and so on. Right now. Control plus spaces. Generate the constructor for it on Let's generate the constructor for this guy on. Now we can create an employee. And as you can see, when I use the counter prospect, I have good here. Sound kind off. Uh, you know Haines now the street name blah, blah, blah, number and country, for example. Polar. Okay, like that. Ah, I created heat. That's a string. OK, that's wrong. So that's changing to end Well, you could give it stream because some, you know, not every state has got the number. Sometimes you can have example a whatever, But, you know, it's just doesn't matter for desertion. So as you can see, we created the employees. Now let's create a stew stream planted. And now let's just return for example, these name plus in the space. Plus, we can get acted no to the address because we send the constructor of others here right here. And we created anything assigned it to here so we can is, they get the country and so on. Right? So we can now just do something like that because you can see we have good now that arrogance from Poland and can you send out without with the street and other things like that? So this is called aggregation. So aggregation means that you want you are creating connecting an addition, clock object inside and another class. Okay. And there is also something with this gold composition. Composition means it is like a specific segregation. That also means that this class he's just nothing without this going. This always sort of these object. Here is nothing about this class. What do I mean? For example, indicated job right, going to create contour plus space. Let's maybe use this created class in the pocket segregation. So, as you can see, re jump doesn't exist without employees, right? There could be many different types of jobs, right, So So it's a good idea to have you in another car. So it is not the inner class right, But this is not something that can exist without employees. Address is something that can exist about employees because no address can be assigned to up, for example, the others off where the card is, right, ah dot Address it where to deliver something. Right, So this is called aggregation, and this is called composition. So there's just, you know, how you call things so really doesn't matter so much. And, well, another example of composition could be, for example, the engine in the car, right. Engineers something that doesn't exist. The doesn't work without the car, right? But that there can be different titles off engines. Right. Okay, So this is how you can create an object inside another class and use it like, for example, here I have shown this own good lesson. Thank you very much.
55. exceptions: Hello, my friend. Today I will tell you about something. What is called exceptions. I would tell you how to catch exceptions. Were there exceptions? And the most important thing? Why do even it's something like that when they really do something very similar. What is done by using the conditional statement. If but the two of is that it has got a very powerful thing that most people do not know about. So let's start from very, very simple exception like that. We cannot divide by zero what will happen as you can see our program. It's throwing an exception that is called like that. And well, you can go to that fire and say what? It what it is. But, you know, we didn't need to care about what it is exactly. We just know that something wrong happened. Our program is not working right. This will not run. You can see nothing after this line around line is wrong. And you have to remember that exception happen. You should catch it. Okay, because there exceptions are thrown, so you just catch it. And in order to do it, you gonna use the syntax looking like that. You gonna type, Try, which means that you want to try to do something that is between discovered braces, instructions to try and later you gonna catch every possible exception like, for example, treatment, exception or no exception, whatever that will happen. And here are instructions that you do in order to make your program work, you know, deserting sections just that you want to invoke. If the exceptions happened, okay? And, well, how would it look in our situation? We should do something like that. Let's try the coat here and then catch arithmetic exception like debt. As you can see now, our program is running. This will not runs. You can see these is going around, right? So this is a place where you can catch exception and sent to the output something informing that something happened. Oregon, you revert some instructions, you can do whatever you want here, depending on what happened right? Right now, somebody divided by zero so we can send to the output something like exception. That and then, for example, get message. As you can see, the exception that e X here is really an object, right? Arithmetic exception is when we go to It is just a normal class that extends runtime exception. And when you go there, you're gonna see that d just gonna do something like that, right? You give, you can just go ahead and head ahead. But, you know, this is just a simple cloth that was that is gonna be constructed when the exception happens. Okay, so when something like that happens, five divided by zero. And as you can see, the exception happened. So here you can tell me whatever you want. Okay? This is just a name of a Rabel. It doesn't matter what you write and there are a few more things you should know. The first thing is that nothing he will execute if exception Waas shown. You can see We just can see only this. Thank you. If exception do not happen, as you can see, we have got the result from here. And these instruction is gonna happen. Ok, so it's really important. Teoh sometimes involved instructions even toe the exception happened. But you also want to execute this Commons when for example, the exception didn't wasn't wrong, right? So this is the this thing you can do in the final a block, so this line will execute always. So as you can see, we have got no exception. And these light was executed. Ondas You can see these line was executed. Still, even if we did not have exceptions. Okay, So these instruction you gonna be executed if the error if the exception happened But these instruction will not be executed then. So this is the, uh is solving the problem. If you want to invoke something that has to happen, happen has to be invoked executed anyway. Okay. And you should also know that you can catch more than one exception. So, for example, here is cart arithmetic exception. What if there was more than one? Let's create our own exception because, as you can see, arithmetic exception is extending something right. You can could create class. Our exception. Of course, this should be self, the scripted exception who had just making some very weird names. Now, here we're gonna extend the exception and now are getting gonna use control prostate and generate the constructor for our class. Ah, and as you can see, it's gonna invoke the constructor off the supercross off the exception. And this will allow us to give our arrow. And then so now you can, for example, do something like that if, um, a equal. Still, for example Zero. You are knotty. I cannot be zero. Of course, this is very stupid, but I'm just showing you how does it work? OK, and you can, for example, troll here an exception. You know, due to throw exception, you can do something like that new then. Oh, sorry. Before it's troll new, and we're gonna invoke the constructor, our exception right? Like that. And this you can see here it's sites that I didn't catch it because you had to cut every possible exception. So you can now use these here and at catch close, right? Like he did so he created it for us. And what we can do the same thing like we did here. Right? And as you can see Ah, now way. We have to remember that this exception was thrown. First of these one couldn't be involved. All so we coming it. As you can see, you are not a A cannot be zero. So that's how it works. So that's how you can throw your own exception. Sometimes you do not want to, you know, create for each possible exception. If they are very similar to each other New, nice. And for each catch, if you just send a message, you don't do anything specific. You can then catch every possible exception using the exceptionally close right, because, you know, exception is the super close so super class can refer to the sub craft is right. We brought in the problems. We can just do stuff like that. And, you know, whatever happened, these air, this it will work. Okay, so these examples were were they didn't show us the purpose of it. Because when you are looking at did right now, you might like, really We could do almost every time just if something then something. And this is just giving you headache. And I at the start relief think told about things like things like exceptions the same. But there was really very good reason why they were created. The first thing is that you can execute something in, for example, finally block when, for example, somebody close the program, you can you know, something suddenly happened and he calls the program, you can say, for example, here in the finally block Because finally, blood, we always be executed. Right? But this is very situation. There is better think that you can do using the exception. As you can see, I have got here a class bottle. Onda. We created it in one of our lessons And this bottle program could get water from got water amount, feel the water, pour the water, transferred the water and you probably not. Is that when we, you know, did something like that bottle being a bottle with for example, five liters on B two and we will do stuff like be transfer Walter. They only turns to, for example Doctor, we're just too much because we have got on the five liters here. We have got your information. There is not enough water to transfer. The problem is that this solution is very wrong. What if I wanted Teoh not send a message? There is not enough water to transfer. I would like to, for example, do something like transfer all possible waters off five. Laters and result. I would like I would like to inform and the bother about it, right? These my solution. I cannot do it now. because somebody all right there gave the solution, right? I cannot change it. Now if I want to change that, I have to create my own bottle class just for these. And this is just bad. And here is the time when you want to use exceptions. Look, instead of retiring fossil true, I will return void and instead off doing something like that, I would just show new exception. And I will just say there is not enough water. Right? There is no enough water. Okay, Andi, As you can see, we have got now here information that if you had drawn something, you have to catch it. So we would have to cut it here. But truth is that we don't want to catch it here so we can inform it. Uh, we can do something like trolls. Exception. We can inform that this exception will be later taking care off here. We had seen the problem is that I didn't say Trump hustle. You can see it's not gonna work right at throws. Clough's exception. So when you throw something, you have to catch it. But you can also say, Hey, somebody else is gonna do it and because transfer water is invoking the poor water method and you know it is returning vote now. So we cannot change here if something is true or not. So we're just gonna do it now. This way. It means that we have to cut it here. But two of is that we still do not want to cut it here. We want to allow how to count to, you know, do it right here. Right in the main function. So we're just gonna tow it again. And now, as you can see, we can hear, decide what we want to do with it. We can also gang throw with a game so we can you know, I don't want to do anything with these exceptions. Just throw it away. There's the There can be reasons like that. Maybe you just don't want to do anything with with this condition, right with this exception like that. But you want to you can now just do stuff like try catch. And now I can catch the exception. Off course I can just creep contra parts Money can just used this gear and stuff like that because I do not like to write too much, right? It is very good because it drives come for you. And now we can send to the output exception Got get message. So there is not enough water. So, Mom, we used the message from here because we can use the message from here. The truth is that we do know they need to use this message now, right? We can do whatever we want. No, we can say there was not enough water. So we transferred the water that was left in the Bootle. They right. So this is the cool thing, because we can do whatever we want them, right? This doesn't matter. He week we gonna say what is gonna happen here, and we do not need to, You know the way. If something give something and we cannot we don't need to do it in here and then again here. And maybe if there was more, more things like that again, again, again, again. So these is the exceptions are so solving some architecture problems, Right? Okay, so this is very cool. And well, I think we shouldn't throw exceptions that are called exceptions. If you want to create your own exception you should call it. So, for example, not enough water exception that we extend exception. And you just gonna control space and involved the constructor wrapped up. And now, at least you gonna see in something. What's going on? Right? Okay. And of course, we do not need to call it the same here. You can call it exception, because exception is the Supercuts who can look like that. Like that. Whatever. But as you can see, it's really improving the readability of our code because, you know, when somebody look at our cars and imagine that you have good thousands of classes and he looked through the signatures off your methods, he's gonna see hey, heres something thrown so there can be a problem. Somebody can want to much water, right? And OK, so I have to take care of it, because this fingers strong. Okay. Okay, So that's how it works. And, you know, it's giving hands to the programmer that is gonna work with your coat. If there was a bowling returned with many matters inside classes, somebody commits it. Right. Okay, So this is the reason the two a reason you want to use sometimes exceptions most time toe. You want to use conditional statements. Okay. If you was here, for example, just for checking the amount exceptions your code with their look hurry board. So do not use it everywhere. Because there is a place for exceptions And there is a place for conditional statements drizzling the lesson. Thank you very much.
56. lambda: Hello, my friend. Today are we explain you something, What is called Lambda Expressions. You will finally understand them. Okay? Because they are not so hard as they sound like. But before attempting this lesson, you should all that you should already know about something would discuss anonymous crosses . And I talk about them in the section about object oriented program. Okay, so if you have been watched it yet, then do it. So just to remind you, anonymous crosses were used to work to create something will discover a behavior right in one line. And you could store this behavior. Then you could, for example, use it like, for example, here, right in the line 26. Or it could create another behavior for at bottom, so you wouldn't. You didn't have to create for age new button, you extension of bottom, right? This will just steal it. So another discusses are great, right? And the two vis that, that implementation can be written a bit different way. That's where comes Lambda Expressions. So I've just used that beans to create, alarmed by expression from this implementation. And this you can see, it looks now weird at least at the start because you're like, what the hell you're is parentis is here is something like a narrow than currently braces in some coat. But the two of is that this and I will use the shortcut control policy is the same as this . Okay, this and this is just the same Lambda expression is just implementation off behavior. That looks simpler. Okay, that's all. So the truth is you don't need to know it because you can already achieve everything with these, But this can look a bit weird if the if you're gonna use it a lot, right? This looks a bit better. Write this. This is just simple one, Michael, but well, if you look at this at the start, you like No, no, this doesn't look simple. This is the This is better. But, you know, let's just start to understand the syntax when they look at this parent is is here why it's here? It's because this method here do not have any arguments. The tube is It's like, Hey, let's create and met it from the action after click interface. Like here. Unless sent here. Nothing, right? Hey, there are no arguments. Then we have got a narrow here. This arrow re presents Lambda Expressions. So disguise is gonna inform our compiler that I've just created not by expression, that's all. Then you have got curly braces high, and they represent the border off this matter, right? This one on. Then you have good the implementation off that method. So it is just this is all. So just a simple version of it can hold that that's only in the Lambda expressions. And the cool thing is that people just make lots off interfaces for representing some kind of behavior, your garden just implementing the behavior that can be reused many times in Somebody called because when behaviour is different for each object, right, for example, list. Let's imagine that you have got the leaves off people, right? And you want Teoh get from the least people whose age is lower than 18 or something like that. And you have got another list off person of people, right? Who you want to choose on the people who I don't know have aut hor have, for example, name that is called Argh. Rather things like that you would have to create each time you class forward right than so . The truth is that you can use Lambda Expressions or the or you can use the behavior like an interface on and create another most clubs. But the truth is that is just the same. And that's how you use it, right? You send hear arguments. Kerry are still turning the compiler, these alumni expression. And here you say the implementation. Okay, so let's do something. Carter, Let's create an inter fight. That's call it action after Click, for example, to, Unless implement action. But right now, this action will have, for example, two arguments. He right like that. Okay, so we've just created another action after click to Interface. So this is one we, for example, I know as two numbers. Okay, so let's implement it. So let's create at a place where we store this action, this behavior. So let's go day to and now we have to send her to arguments. Okay, so let's create parentheses and let's say in in big, it's just sent two variables there, and now we are using the hours. So we are telling, Hey, you know, we are going to create lumber expression and now we have to say what will be inside the methods. Like the action too. Let's send to the output. For example, I plus B Okay. Andi, I think that it will be good. Right. Um, we still have for Rabelais is already defined. Um, probably because you find here. Okay. Eso three deadly. Um, incompatible types incompatible parameter types in London. Expression in a and B way. Send ah to the rebels. And that's to, um that is Well, this is my fault. It is good that I made this mistake because he could have made it also. Look, I just Oh, that's good. Good idea that I made this mistake because, look, the truth is that you can have only one action, one behavior per one interface for lumber expression. You cannot do stuff like void action to ah, and I and you can see now it's gonna gonna work because you can. Because, you know, Lambda Expressions just short thing to just implement one behavior, that's all. So for it behavior, you have talks. Have second inter prison. As you can see here, I tried to use the world action after click, so I try to use these interface and I send there about it. I m being there is no signature of matter like that. So the truth is I should have just use something like that. And now it's okay, right? And, well, we cannot use here a because, Well, he doesn't know which eyes here, which way he's here was just something like that. And ah, well, it's still as you can see now it's working. And look, when I do something like that, then click here. I can use anonymous in her class. I can change it. So it looks like on on this graph so you can see exactly what I've just done here. Right? So I just created action after quick do and I implemented action to with two arguments. So in the end, be and the implementation of this method looked like this, that's all. This is the behavior that we can use now somewhere, for example, in the bottom or any other to tell any other class righted. That's us, that we will decide where we can use this action. So we can, for example, here at Action two and now we have to in get here action after creek to and for example, we call it the same and will invoke action to the problem. Is that going to send here some arguments we can send here? You know, whatever Foreign five. But it will be good idea if we had taken them when somebody involved this matter. So we can do something like and ex and why? And we can send them the right and extend why on and well, now we have to involved so p that and as you can see now, we can at another action like that so we can send the argument. There's example 10 and then, for example, 15. And we invoke the behavior that is represented here. So that's 10 plus 15 is a concedes 25. So, yeah, it's working fine. Okay on. Of course we could you take it here and do it like that. Take this under common, and it's also gonna walk right? Doesn't matter where disease is just an implementation. One line we saved it for chief so you can reuse it in, for example, many bottles. But hey, you can do it in one line. It really doesn't matter on. Well, let's do something giving harder. So for example, let's return here in Teacher, what will happen? Well, because we are saying that this thing has to return integer this action to met it. He would have got a narrow because we didn't return anything. Right? Because, you know, here is the implementation of these metal and there is no return. And if you return keyboard so we had to return Now, for example, I probably so we do not need to send to the output it now we can do something like that then. Well, this will be enough. But the truth is that well, when you're sending here XTO So we're sending it here and then we are invoking it with the arguments that were sent here. Well, the result is here, so we have to also return it here. So we're gonna return. Invite that. And now we can store the result here. Right? And we can send the results. You doctor so like that. When does he concedes 25. Great, isn't it? So that's how it work. If you want toe also have a return, right? So, in order to see how it works, use anonymous intercourse. So he's like implementation off the action too. So this guy, two arguments, the returns, it's all the talk and the cool thing that you can make it a bit smaller, even small, right? You do not need to type your anti drawing teacher. Why would you even need to type it here when the interface can only represent one behavior ? So, hey, when you look at in here and interior, when the compiler looks at it, he's like, I know what's there. Why did you even type? But here, you do not need to type a gig again, right? So this is gonna work. And the next thing is that when you have been something very sure, like return statement on their own, even shorter. Why even bother doing all these things? Let's do it just that way. Okay, return a plus B. All right away. Why do we even need return? Q? Let's do it that way. About 25. So Well, this looks simpler. Right, then if we had, you know, in across here. But it also might be hard to understand for some people. And they look at this when you look at something like this, when you find something like that in a coat, you will see Lambda Arrow, right? It means that somebody wants to use the lamb. That expression here are to think that will be used inside the method. And here is the implementation. Okay, so you are just saving it behavior that you can reuse that you can use somewhere, that's all. OK, you do not need toe. Exactly. Know you know what's gonna happen, because that's would you go? Not exactly. Do right. You are the person who's gonna make the action right? And that action would be used. Somebody else. Okay, so the reason off anonymous glasses and the reason of Lambda expressions is to create actions, behaviors that can be used in other classes So you don't need to create for each action. And you class, there's only the lesson. Thank you very much.
57. documentation: Hello Today we're going to talk about documentation. Well, there is a very big documentation off. Oh, possible classes that were created by the Java creators by There is just tones off packages with tones of classes that you can read about with. Don's off, matted and really I don't know all of them. There is none off, you know, programmer who knows all of them on day. Remember off them. That's why people are creating documentation, because it's just impossible. Well, just humans. It's impossible to remember everything. Try And when you look at the park and you have been the description of the spark it's been when you go to this park Ege, then you can go to a class Sumeria. That's say something about the classes in the pocket, right? And when you go to the class, you can see that these claws implement something like that. He re some kind off description off the then you can you can give some notes. Here you can see from which first and is available. Here. You have got some links. Eso you can goto Another thing that is related to this. You have got to feel summary and contractors and the methods. And you have good top. So you can see, you know, starting on the methods, you can see what is returned here. What? What is exactly happening Key. Right. And you can create your own documentation, and that's really cool. So you have probably noticed that I didn't delete comments in his lesson. These very weird, right? Because my mother, I delete them. So this is a normal multi line comment. Ah, well, here you put just listens. You say that you can use your come your program that was created by you. The way you specify here, that's all these not documentation. Recommendation is something like that. When you add one more asterisk, you're OK. It is the something that will be interpreted by the Java program. When you create here of run and then create generate java documentation you're gonna generate. As you can see, you can take it from the path like that and you can send it to someone these a java documentation for your package with your classes because I can go to the main right now. Here is nothing right on. This static method is gonna be executed when you run your program, that's all. So now it's your time to create your own documentation, right? You can, for example, change the outdoors mind and McAdoo's without trick ride. You can, for example, do a version of these, for example, right now the version of programs like that two days, for example, that they like that so you can do whatever you want you right, and can describe the classes. So let's create a class, for example, that were called employing on Let's What does the same things like here. Right on. That's, for example, describe our employee. So, for example, on class and now we can use HTML tax. That's very cool. So in order to, for example, say this is called employees and re presents employing and it is super class for and you have to Burma La, blah, blah. Uh, so this is the place to describe when you generated. Now, as you can see here, we have got the description off it, right, so it should be description of it. When you go here here, we have bigger version off it on. Dwell that that's how you use it. So let's let's create something maybe harder That's great. If you, um private, double salary, private, three name, private drink Start right. Something like that, for example. And let's create constructors so controversial Space Contra plus space. Let's create now a getter. So get for example name Get very get turning now set there So controllable space that names that salary and said so Right, So we've created very farce of humanity. It's using cover i d And now it's timeto fork creating the documentation, right? So, for example, we can recommend this constructor. So as you can see, it's very cool because this idea is helping you. And it added something like here that ed notation the parameter. And now you can say that this is constructor that will create on employees with ah property . Taste that wheel. Describe salary name uncertainly. I do not forget to whom you can give some hint, right, because I, for example, salary should be You know, you shouldn't use very big precision because these double you should use different type really here and living like a problem. So salary describes our sets. Salary employee. Ah, uh huh. Some name. It's our name. And now when you generate it, you and notice that we have got now bigger description like that. When we go here, we can see the description of parliamentary. So pretty Elson, Right? What about, for example, returned? Because you can see we have good things something something like that returns the name off employees when you generate it. He will not this that when we dio toe get name, have good information would be true tears We don't need to say returns because skill rather so that we could return the name off employees, right? Does you know? So you can also give some additional interim information's right. It's just up to you. What about here? Parliament. Her name so sets the name off employing. And here you can give some additional informations like it's gonna check. Give the name IHS. You know the name off woman, our home. If it's woman's gonna accept the defeats, man, it's not gonna accept whatever you know what it's about, right? And we'll new generated you go now have information now for setters going to see here when you go here than you can see the parameters, everything about it, that's very cool. And you can, for example, informed that, uh, well, they scatter these scenes. The version 111 right. Something that and when you generate the gain, you will notice something like, Oh, get name. It's scenes. Version 100 So something you can inform some button about something like that. It's a rivalry using things that you create. It's mostly using, um, the official things like, for example, this year. Okay, Andi, you have got something very important they didn't tell about. It's something like that. You can do something like, see, See? It's like saying giving information the show, no information about the thing you want to show. So, for example, you can now, as you can see, we have good suggestions here from our I d and we can say project documentation. So it's our package name, and you can send somebody to, for example, employees. And I won't consent him, then using the harsh, uh, hash to the property or to the methods right so I can send him. Hey, you know, we want to create it. Go to the constructor. Whatever, right? Ah, generate employees. And when I do something that instantly the default constructor so you can give you can send somebody to something that's very important about your car. So, for example, off classes that were in carried it and you can give information wide for important, right? This is very useful. You can also give the normal in care. You can do something like, for example, using the HTML can give you the link to the websites of example. Actually, tpv your courses online dot com right on. You can use the target tribute to open it in the new ah top. And he reads the name off website. So, for example, video courses like that on when you generate it. You were not this that here, when I take it, it's gonna open the website video courses online that come right so you can send, for example, toe the article. Did we describe your class? Whatever. That's just up to you. The cool thing about these descriptions is that right now you have good additional information. Look, when you do stuff like that, um employing have good the description that you created here. You have good also links. He right? You can use them that school, what we look like. Look at this. It even opens it here. Right. Well, maybe for weapons. It's not gonna work so good, but a it opens connection. You can jump from displaced another so we can create employees. And now, as you can see, we have good get for example, name, right? What does it do? It returns the name off employees. Okay? Of course. You know this name is self descriptive, so problem about it would read it. But if there was something very important done inside will be probably good. Good thing, right? The cool thing is also the deacon, for example. Show how to use it. So employees, new employees and then, for example, e don't get neck right. These symbols always may be useless. But if you have something hard to use, you can show example on when you generate it. I don't like that. You can see we have got now here how to use it. But it's gonna see everything is one line. That's because it's html and you want to make it pre formatted. You're gonna use the pre format attack, right? And though as you can see, it's nothing online, so it's more read able. It's a good idea to also say something about your property sometimes. So you can say this is salary in, for example, dollars. And now, if you could created a mattered you could, you know, days that you can see you have got the information about the property here, So it's also very useful. So that's how it works. You can create documentation, and you should do it for at his bigger project. Or you should, you know, make it hard bit off creating documentation because it was safe. Lots off time for people that will use your classes and maybe not only for other people, because I really believe me when you create something when you program something, you're gonna remember it for maybe one week, one month. It really depends on your memory. Sometimes maybe six months. But after I don't know, you come back to your cold after one year, two years time, you are gonna be surprised that you were such a genius to create the code like that. And that's the time when the documentation, when examples of usage of your code is gonna be really helpful. That's why you should create the commendation. Andi. Well, that's only good. Listen, thank you very much.
58. Default methods: Hello, my friends. They were going to talk about default methods that are available to use since Java eight. So this is a new feature. Normally, when you created an interface like that and you call the formula, for example and you created the class A and you implemented a for Malala formula like that , you would have toe implement all possible abstract meant is there right? Because by default they are all public and abstract. That's how interfaces working. But since Java and you can create something like a default meant it so you can type default . Then you can type, for example, default. Kabul. I know, square root. Let's create a method like that, and you can you have to now implement it here. Okay, You have to give the default implementation of it. Okay, So if you do stuff like that, well, you cannot do it. You have to pass the default implementation. So let's return, for example here and met it from the math class. That is just gonna count the square root, right? So we just implemented it by the fold. Of course, somebody can override it now so he can do it. But he doesn't need to do it right so well, it has to be. Probably because by default is public right and you can add overwrite and notation. And that's okay. There's all so you can, but you don't need toe. And now you might be like, Why did the implement It doesn't interface look like abstract class now? Well, it's a bit more similar topside, Kozma, because you can now choose which one is abstract images Not. But you know there is a very big difference steel you can implement more than while formula . And remember the D view extent, abstract class. Then what? Then it's the end. You cannot extend the class, and the more you just extended that causes all eso you can extend on the one and you might be, you know, asking yourself, Why did they implement something like that? Imagine a situation like that. Well, imagine this is a real life example. Job creators created money interfaces a long time ago many years ago, and they couldn't predict every possible method that should be in the interface. And now imagine the did. Every programmer in the world that used Java, for example, implemented one of the interface, right? Very popular one. Right? And now imagine. They added one. You met ID. Every possible program I will need to implement is not that now to the class. So it would just destroy totally every program that has already been waiting. And this is the solution. They could create a new method and give the default, you know, default behavior for it in the same time. And they wouldn't destroy all programs that we have already been written. So, you know, programmers that do not care about new futures, they can still use vehicle and programmers school cars and who wants to upgrade their coat wants to use new features. They cannot do it. So this was the solution for for something like that. So this is really great solution for upgrading interface. The truth is that you should, you know, create interface is the way, so they will never be upgraded. But, hey, this is ah, hoc solution. Right of you did something wrong. You can create a different method, and then it's gonna work. And well, it's also good to say that interface because good one public abstract minted. It's called functional interface because it has got. It is used for the creating actions. So, for example, you know, when we did something like that, this is called an action, right? The behavior that we're storing somewhere. So when were you have to remind yourself about the Lambda expressionless and now here. And you know, we could use the Lambda expression if Onley one method was inside interface. But as you can see, it's still working. Why? Because well, here we have got default method. There's not abstract, right? It's not abstract. You don't have to override. And because you have got still on the one abstract method lump that will work because, you know, Lambda will look for the signature off method that has good something like that and that this abstract, he doesn't care about this matter. So Lambda will use this method here to override it. And we can just put here some kind of called the Well, you know, return five, for example. Whatever. We just implemented the formula fast for the luggage can be, you know, years, years later, right? Right on. And as you can see, you can use pretty easy the default method to So this is how How it works, right? You can. You can now have more than one method and still use Lambda. But only one met. It can be at the same time. Abstract. Okay, that's only the lesson. Thank you very much.
59. What after this course: Hello. Congratulations, my friend. You've just finished their video calls about Java. So now you know perfectly this syntax of job. OK, but hey, it's time for training. It's time to create something great. And after discussed, I think that you should go ahead and for example, learn something about creating android application. Because here is the place where wrister to cash, right? And, well, I would create a cause about Java android. So maybe it's already created. You can check it out in my profile. But if not, you can go, for example, to this website and learn about it. But of course, it will not be as good. Explain this, I will do it. And, Well, what else you could learn about Java database on because, well, this is a good class. Did will allow you to store some off the data that you're gonna use that very important thing you could learn about concurrency in, which is gonna give you ability to create multi treaded application, right? So it will improve speed of your application. But this very advanced stopping so it really depends on situation. What? What you are writing? Okay, um it's also a good idea toe know how to create desk a couple applications. The typical desktop applications applications right, for example, Idea. Right lying landings So you can learn, for example, swing or you can. They learned the new Java fix. So this is the things that I think you should do now. OK, after discards, you should not train. Use the classes that have been already provided by other people and try to learn them. Try to create something with them. OK, so that's the thing that you should do after this cost training, training and train. And well, I like to thank you for, you know, taking discussed. And if you have any questions, really, I laugh, helping other people. So just create a discussion on guy would respond us fathers possible. And when I would say it, I would just responded that that that's my way. Of course, I can sleep when you are, for example, asking something because I'm from Poland. But when I'm online when I am not, for example, we can recite like that, I will explain you everything. There is this possible way. If I did something wrong, that's more my fault, and I should explain you it better Way right is my fault. And it's my responsibility toe. May everything the s easy. So? So it's easy to understand for everybody. Right? And, um well, if you can. Well, this is not requirement. I would be really glad if you could relief a fade back for my cars because it's really helpful for me. Okay. And well, there's only the lesson. I wish you good luck. Thank you very much.
60. BONUS: generic methods: Hello, my friend. Today I will tell you what our generate matters Generate methods allows you to make the type that is gonna be generate between the curly braces off these matters. And when something like that is useful. Well, here I have created free errors. As you can see, all that arise have different type, right? String, color integer. I've created the color one, the others one are created by the Java developer. So this free classes have got some kind of values, right? These will have got this sequence of characters. These one has got the name of the core. This one has got the values off, you know, indigenous, right. And you can create your own one. You know, like the person and the person we have the name, the silent and things like that. So and here I created the color and you have got here, you know, together the constructor, the name of the color that you can set here and you have got here overridden mattered. That allows you to compare these colors, right? So you can go ahead and create your own one. And almost always you we want to create. For example, omitted. That is gonna count. How many items are insight? An area. Okay, so you would like to check if there are, like, three occurrences off the coal or red, or if there are two occurrences of it are you want to see if there are strings? That name is like that, or you want to see how many numbers are equal to right? So these very frequent operations So normally you would need to create something like that public, a method that is gonna be, for example, static. So is we can use it without creating the class. Right? Because with this method is really something that doesn't need a class, right. You can compare whatever you want. So in public, startac and it's gonna return integers of the number off occurrences. And the name should be, I think count item occurrences. Right. And now we should take here. There. Area were from where we can't How many items are inside that all right? Looking like we providing the second argument. So, for example, like that And now string, I tend to count, right and well how to count it. It's gonna be hard. We just need to create a temporary of arrival. That is gonna start how maney items are inside. And we just used the loop right, because we need to go to each off that value in the area. Right? So let's use that for intense for loop. So we will do something like that will create an item. Temporal are items string from each element off the argument that is gonna be sent here right like that. And now we can just make a comparision it item that equals to death. I tend to count. So the one that is gonna be used as the second argument, then we can, for example, increase this well, count by one. And at the end, we are just gonna return the count. Right? So this is gonna work for that situation. Let's check it out. The end Count off. Ah, strength. And now we're gonna send their something like that. I want to look for the A Currency's off a right. So see, out sees strings. And now let's just plate. Does it consider its too? It's So we have got to a currency spoke A If I do something like that, he's not gonna find anything. Divide something like that. It's gonna find this test here. So it's working Fine. But our method is not gonna work for the colors for integer, right? It's not gonna work like that. Why is not gonna work? It's because we have got to kill a different type, right? So the truth is that now it only the the only difference. That would be if we created another method for counting, you know, colors or integers, the all currencies. So values that right would be only to change the spicy. So it would be like all our cool or color. And it's not good, right? Because the truth is that if we change, something in our algorithm will need to change it in every possible price place, right? If we had, you know, man types we'll need to create Vanna matters. So it'll take loads of time. So the cool thing that comes to reach rescue us is generate matters because we can just do something like that. We can create our own type. Okay, so this is our own time, and now we can do something like that. They day and stay here, okay. And with the solution like that, As you can see now we can do the same to, for example, colors here So we can do something like we can send here the area off Colores. And now we can send their for example I want to look for color. That will be right. Okay, um, variable c string is already defined. Also, would you didn't change the name here. So, um see, Colores, I think that unless you can see it, uh, it's saying that there are two times there are two items with the value, right? Right. And it's serious. We can, you know, increase the number of items inside. As you can see three times. Now when we change what something goes, it's zero. So it's working fine for another type, you can as an exercise, use it for integer also and well, it's also working on Lee because of this matter, right, Because this method is gonna be the same for all possible objects, right? For all possible objects, theory is gonna be a method called equals. So if somebody wants to use the count item occurrences, he has to You have to remember over right that method so you wouldn't you wouldn't not have to change anything in society, right? And you might be now like but how thus our compiler knows about you know, this type here. How does he know that? Hey should port here. You know, in this situation string and in this situation color, How does he know? Went toe replies it. Well, he knows it when we execute our function when we involved. Okay, So in this situation we're sending here s on this, as is in the area of strings. So yeah, it's like, Oh, it's gonna be sent here on because here it's drink. It's also gonna be stirring. Here is also gonna be string here, this thing on there say, you know, for the compiler eso he knows that we're gonna use, generate, mattered We're gonna use the generic type somewhere in our mattered, right, because right now this is just for our compiler. Nothing But what? Stay when we just talk like that. We're saying, hey, you know, we're gonna use here something what is gonna be called T. And it has got the meaning and the meaning of it is gonna be sent hearing this place where we invoke that mattered. Okay, so this is very, very cool. You can also use it with the, you know, every list you can use inside the type like that. So you can then, you know, have men ever released with different types on. And you can take as an argument on a release with many different types. And you can do something with them pretty easy. Like, for example, I think new item in terms on so on and so on. It's also good to know that you can use extents key words here. So you can say something. You know what? I want to have your only colors, okay? And because of it, as you can see now, this is not working. But this is working still, right? It's still working here for the colors. So anything that is gonna extend color, it's gonna work. But otherwise it is not gonna extend color. It's not gonna work. Okay, thank you very much that during the lesson, Have a good day.
61. BONUS: Generic types: Hello, my friend. Today, I would tell you about general types. So far, we've been creating variables specifying the type of a rebel. For example, we type something like string and then the name of variable. Right. So this is something good. Is skulled role type. Ok, do this, John. Just something that is a typical type. Okay. And now we will learn about something good is called generate type, because sometimes we want to bank a type that this generic. But what does generic word mean in this situation? It means that the type is gonna be universal. Okay, It's gonna be generic. It will change according to what we want in specific situation will be able to create something. Would this called a placeholder for the type? Okay. And as the name suggests, placeholder holds the place for the time. It's like a power matter for the type. Okay, we can send an argument to the type you here. Okay. So when something like that is used and how to create variable that, you know, can changed the time how to do it Well, let's first see how the creators of Java use it. There is something good is called an aerialist. Let's import it so contra plus shift with I And when we created we have got now ability to add to the aerialist Something will discover elements we can adhere and the type of object . Okay, so invite do something like that. New aerialist. Now we can using this name of a rebel use methods from the Arodys. Like, for example, at would you allow you, as you can see? Well, again, you can send here an object, right? So you can send he whatever you want. You can send him whatever our lemon So a released is something we discovered a collection. Okay. Which means that you can collect there many items, many elements so we can send that, for example name right that we created here we could create more name. So what's stuff like our egg thing too? Veel, uh and well, we can it one more like that. Okay, so this is working. Fine. But this also means that you can adhere whatever you want, right? You can do new object. You can just insert here whatever you want at the moment because, well, the signature off this method is looking like that right? It takes objects. And because of it, there is a problem. If you want to get something from charities, you will do something like and that get as you can see. Now you take the position off the element. So, for example, let's take position zero, which is the first position, which is our moment. So if we want to get access to it, we cannot decipher, likes drink first name something like that. As you can see, we have got here in an hour because we have to do down casting. Why? Because get is returning the object, right? And object doesn't have access to the methods off the classes that extends object, right? Everything extends object. But in order to get access to the methods you have tow use down casting. So you have to do something like that. And the problem is that Well, for the first guy, for the second guy, you can do it. But here it could lead to problems, right? Right. You could have a few. You know, your own classes put their like employees and other things like that. And the problem is that this is gonna always compile anyway. right, Because it doesn't know exactly if you're doing things right, so compilation is gonna take place and you would have an error later if you cannot do so, for example, something like that. And at new the employee, right. If you do something like that and then you get the 012 free start element. As you can see, we have got here an Arab, right, Because we tried to invoke something like death. So how to solve it? We have got something with this called a general type. And when I use the counter and creaking a released, as you can see, we can go to the description of this class, right? And here you can see that we have got to hear something like our A list. And then we have got to hear something like that E which sends for element. OK, and this thing is a placeholder for the type that will be sent using something like that. Okay, you can now use that science here. These diamonds signed like that, this lower and the greater then sign and you can send here, for example, streak. And it means that it's like, Hey, I'm sending us argument here This string and it means that I'm going to replace every possible A. As you can see, every possible like that is gonna be replaced in the coat by this string. There are some additional things like extends. Maybe somewhere you have seen some, you know, weird things. Don't worry. We talk about it next lesson. But so far we know that this is like an para matter, right? Right. And here we are sending an argument to this class, right? And we want to replace all these feet and because off solution like that when we do, ofcourse, something like that we need to know involved the constructor like that. As you can see, we have got a narrower here. It says, You know what? No suit table method fund for at object? Because right now it's like, you know, we've just created a special cost with every possible method that has got signature with string. OK, it is now not generic. Using something like that, we created a specific new type because it's like a template. Okay, template for creating clauses. So right now and when we do something like n dot as you can see. We do not say here as the suggestion object. But could you have got your string? Because the two of is that we created a class using this right we created using this template and it works right You can now use. You can no only send strings using this method at so problem like that will not happen. And you will not have to also comply here, animal. The cool thing about template is that it is compatible. Beg Watts. Okay, Because you know, Java is implementing new things into the libraries and they implemented something like that and many people have already used. You know, I released with the down casting other things like that, right? They could, at every possible object to minorities and so on. And but by default, if you do not specify anything here, Okay, so if you do something like that, we created attempt off. We created using this template a cloth that, you know, we'll replace this placeholder everywhere with the object, right? Okay, so if you do something like that, it's gonna look like that. And it's also very important to know that Look, you do not need to Spotify here again. The street. Okay, since Java seven. You can use here on that. These diamond. Okay, because it looks like a diamond. Um, operator. And as you can see, it's still gonna work. Fine. But why isn't working, Index? We hope it's because we're trying to get to the tournament that I deleted you, right? So as you can see, that's how you get now. The value first name you can know. Send it to the output so we can now use it. Like if it was string right. We do not need to dunk cause it every time it's just gonna work all the time. Now, as a string, let's not create a special clause that will be just created by our side. Will be able to do things like you know this area. This for example. So let's take the class Then we tied the name of the class blacks, for example colleague box. Then you use this signs and inside of it you tied the placeholder for the future type that will be used inside. When? When? When somebody create a box. Okay, so you can type you whatever you want. And yes, this is gonna work. Okay. You can see it's gonna come party, right? It's working, so you can type in with everyone. They type here e because it stands for element, right? Some people type here t because it stands for type, But you can type your whatever you want and you will work because this is a placeholder for the future type. OK, so whatever you want and for example, name over able and yeah, it's gonna work, right? Look, eso you would do something like that. Books box near box. As you can see, we created and books with the name of a Rabel. The type is object because we didn't specify anything using the syntax. Right? But what? We can do it? Hey, I want to star in my box Onley strings. So we need to also as here now, something like that. Because if you do something like that, you are really creating, you know, you think you are using your constructor that is gonna create, you know, methods with with wrong signatures, right? This is gonna be row types thing. So you should do it dead way. It might work sometimes when you do it that way But sometimes it can lead to problems. So remember about doing it that way, which will, you know, guess what's here, and you can take the game. But I think taking it again is just read Doomed under right. It means that it is, You know, the Shona work that do You really didn't have to do so Right now we created the box. Ondas you can see now these books is gonna start inside a name of a rebel. We're able a streak. Okay? And now you can create, for example, Getter. So get whatever you want, write something like that. That and you just need to return this type, OK? Like that. And, you know, you need to just return. So as you can see now we can type something like box that get whatever you want. And as you can see, it is working. But we don't have anything inside the variable. So let's create the setter. So settled doesn't need to return anything. We can set whatever you want and said these name off Rabel said your name over a bill that will be sent. He'll right, but maybe valuable for able and the value will be what type? It has to be that type, right? It has been the same type like here because there's a template for creating these books, and now we need to use it. So Simon itself. Oh, okay. Because I didn't change here. And now let's the self like books that set whatever you want to our car dish, right? They can see. Now we have got here are Carter because we said it off course, it's better to call it a bit different way, right? Like, for example, let's go everywhere, T. And here we should, you know, set name of a Rabel. And here get name of her able. So it's, you know, breaking bad that this is just a placeholder. Do not worry about it. Okay, A placeholder for there. Type that you will want to use. And and you will say What do you want to exactly use inside he right when you're creating of a Rabel or when you area constructing? If the right but like that. So the cool thing is that you can create now another box in another box. You can no start. For example, employees right? And in that another books that we could books to Now you can add Ah, as you can see now you can set name of a rebel for employees, right? So maybe it's wrong to call it said name of arrival. But, you know, set a lemon, right? We lied about her. No. So get element element. And now just value off And I went. And here, element 11. And now this is a self descriptive class. Of course, I could start from creating it like that way, but it might have been a bit harder to us understand, For on. So this is good feature because you do not need to check them. If the clauses instance off something devious, then do it that way. You just You don't need to dunk. Use the down casting, right? This is the solution for things. For things like that, that's something. That lesson. Thank you very much.
62. BONUS: wild cards: Hello, my friend. Today we're going to talk about the willed cup. Will cut. Is this question mark And it allows you to do something very hard to understand if you do not make some kind of practical example. So let's look at the classes that we have got here. We create in the last lesson class. We just called a box, right? And this is a template class. So it means that you can create a general type, which means that you can send any type. Ah, that will be replaced here by these letters. Right? So we consent string, and then it's like creating a specific class just with everywhere string our employees objects, right? So it's here. We created class with strings. Here we created class through the employees here. We created classes, objects, okay. And, well, it's gonna war dragged when you do stuff like books of strings. Now, when you clicked up, as you can see when we look at this description of get a lemon is gonna return strength. So yeah, said alignment. You can send here a string and set it, but a what would happen if I wanted, You know, send these boxes somewhere for processing, right? Well, let's imagine you want to, you know, process all possible boxes at once how to do it. So let's created, for example, class parole. So think boxes, right? Something like that. And, well, let's create a static. No returning anything mattered process. Okay, I brought this box and here is the good question. What? We should take you right? Will it be box off objects? Something like that? Would it work? So if I do something like processing boxes, prophets sing boxes duck. As you can see, we can use the static metal without creating the instant because it's starting right and you can send their books off objects, right? It's working fine, but I cannot send their books of employees. It's not working. I cannot send their books of strength. Why isn't working? It is not working because the types are wrong. Look here we have good books of object and we need to send her books of object of a Rabel. The type is like that, right? And he was sending really books off strings are Reiger. Singing is an argument to this class string, so this is totally different cloths. So ive you want to process here more than one generic type, right? And we've different parameters here, right? But with the same name off glass, then you have to use the Wilcutt, and this will cut is just as you can see this question mark sign. So now, as you can see, you can send the box of strings. We can send the books of employees who can send their books of objects, right? Everything is gonna work fine. So this is a weird card because it means it's wield its It's so well that it can change the type and whatever it wants, right. But it also gives you some problems when you do something like books that, as you can see now it returns. Question mark. And when you said that Lemon, it's also the question market, which means that what you have toe again do something would is called checking, for instance, you have to again, you know, when you returned value you need toe do casting, but it's okay because it is Now. We are sure that if somebody uses box off objects object or the books off employees object , he is gonna at Onley employees or at Onley objects. Okay, so this is still a very good feature. You can do something like, for example, at award extents. Because, you know, now, when he was a question mark, it means that it this object that is gonna be sent you right box off objects, for example. Ah, this our box of object is type is books off object? And that's object extents. Objects? Yes. Thus employees off extends Object? Yes, because any class extends object, right? That string extent object? Yes, because in the classic sense object, that's why it works. So by default here, it's something like that and it Okay, so this equals this. Okay, this and this is the same thing. OK, so it's like, Huh when I sent here box off objects, right? So he's like something. Let's check in, um, that subject extensive, just okay. That's so it's gonna work. That's employees extends over. Okay, it's gonna work. String. Okay, it's gonna walk, right, But ah, this means also that you can change the thing that is gonna extend it here. Right? So you know, you can say something. I want to take on Lee things that ah, on the object objects from boxes. Those are gonna extent employees, right? So as you can see now, we cannot send your books off objects, right? We can send on the books off employees And now yeah, it's gonna work. You can send hear something like that. But it also means that if you create no class super employees and extend employing right and you create a box off super employing books of super Implore IHS. As you can see, I can do it also because super employee is really extending employee. Right. Well, we say it here. Super in tow, extents employees super, including instance employees. And that's why you can send it here, right? And then you can work with it. So that's how you use will cut. You can rest. Restrict. You can restrain, right? You can limit what things can be used as a para matter for the generic type. OK, so will card is used to restrict what parameter can be used in general type. Okay, something I did. It's also good to know that you can use it not on this world, its extent extent, you can also use weeks, for example, here with the typical generator so we can say something. I want to have your only boxes. That's gonna extend employing right side. And as you can see instantly, we have got here and there are and here in error, right? So, yeah, we can do something like that because employees extends employees because what? It's the same object and super employees extends employees. So that's why you want to use with cars in your program. Thank you very much.
63. BONUS BASICS OF ANDROID: Downloading and installing Android Studio: Hello, my friend. Today I would tell you how to install and how to download and draw its studio. In order to do it, you just type Androids stood, you download, and then you go to the first weapons and he we can do it. But before we do it, I'd like to tell you what it's android studio under its studio is, as the name suggests, a studio. So the place where you have good lot off tools that are connected to creating android ups. So you have got there, for example, a Combinator for your java programs, right? You have got there some kind of an editor that is gonna have a coat competition for you. You have got some kind off we just that you can put onto your devising is gonna create for you lots of code you have go there for example, an emulator that do you go now used to, for example, emulate lots off smartphones because it's not possible for you to have one thousands of different smartphones with different versions and different sizes. You can just emulate all these things, right? So android studio is really something very important for you. Is gonna help you update you the new s, for example, as decay tools. So software development kit tools eso some packages that are used for development software . Right? So there is gonna be tones off useful things in Android studio, and it just needed It's free. That's very cool. You just need to download it now, so, you know, did to do it. You can click here, but you might not have the windows. Right? So if you do not have windows, you just go to the bottom of this page. And as you can see, you can download it for macintosh for the Lenox. Right? Um, eso you can click one off this on. It's also gonna download. Okay, but if you have windows, you can just create here on, But before we go into it, I'd like to tell you about requirements, because it's really good to know that Andre city requires two gigabytes of ram. So and this is even forget about drum recommended on Did you need to have At least I think five year bites off space on your DS. Okay. This thing here is I think not to You need to have at least five year by Okay. And the next thing is Javadi low Pinky, I hope you know how to ride in the finger in Java because, well, if you do know, you should, you know, go first. My first cars about Jave are learned on the Internet. But you should have already installed something like Java loping kid. Right? And but you might not have the newest version. And in order to, you know, inside it again just tired. Javadi low pinky download. You just go here and then you just click here and you can download it here and update. OK? Because if you do not have a new version, you are not going to be able to create applications for Androids at the five plazas applications. Okay, you can, you will. You something so it's not gonna work for you. Okay, So if you have good did, then you just click here to download, right? And when you click on it, as you can see, we have been something like that. We're not gonna donnelly the game because we take too much time and you just click on it. As you can see, the sun set up is loading Okay. Lets wait a second and we click next. Then it's good idea. Toe insult everything here. Okay, we could connects. As you can see, we need 4.3 gigabytes. So it's a lot, and there are gonna be lots of updates, so it's good idea to have lots off free space. We kick next. I agree. Of course. We read a lot. These license agreement, I agree. And then we should specify one. Want to install our android studio, and we're going toe install the software development kit for Android stood student. Okay, then we kick next. Here we are being asked that, as you can see, at least for me, maybe you will not see it. But I have got intel processor. And that's why I can have the accelerated manager for, you know, Emma waiting the smartphones, for example, for device for emulating and a device. And because of it, it asked me how many around how much ram I want to reserve. Right. So I'm using the recommended value. For example, two gigabytes. If you do not cavity, you gonna not gonna say it, but well, as you can see, it's good idea to have something like, for example, Intell. Okay, so let's click next here. We just name our android. Still do it quick install. And now this thing is gonna take about five minutes. It didn t depends on your computer. Okay, so let I would just, like, stopped for now. Okay? So the installation is complete, and we're gonna creek next. And as you can see, we can start our android studio. So let's click Finish. And our android studio is being open, As you can see now, firewall is being asking me is important. But you just asking if I want to allow it. Teoh actors, you know the Internet. Okay, I'm allowing it. And as you can see, it's gonna right now update something. It doesn't need to happen to you. Okay, Bob, Maybe it's gonna happen. It really depends on the situation when you're gonna download this android studio and what was inside of it? Okay, so for me, as you can see, it's gonna Donald something's gonna take some time again again, and I'm gonna positive. Okay, So after installation process is, you can see we have something like that. I could finish, and then as you can see, we can create our first project. As you can see, I have got here a few products already created by me. But this thing is gonna be a down in the next lesson. Where I gonna tell you how to create your first project. That's going good lesson. Thank you very much.
64. Creating your first Android Studio project: Hello Today I will tell you how to create your first project. But also I will tell you very important aspects off Android studio. Like for example, what android version? You should choose water activities and so on. So police try to watch this lesson full because normally in other courses, when creating projects are very easy just click next, next, next, next, next. And that's all but here. This is very crucial. Crucial. What you gonna choose? Because if you choose the wrong version of Android, your application might not even show in the Google play, sir. And you know, I m for example, money. Or you know you will have problems because your applications will not show almost for anybody. Right? So let's start strong, keep clicking cares start a new android project when I click on it. And as you can see, I can choose the name off my application and this is very crucial. Why? Because this is not only name off, you know, off your application that is gonna be visible just for you. Because this name here is gonna be visible on the smartphone. So you know it should be Catch it right? It should be something looking very good. Okay, so you can call it whatever you want. Body. It should be a nice name. So, for example, let's say OK, the calculator. Okay. And as you can see, and now we have that here. Something like companion domain company domain is something that should be unique to you. Why? Even somebody created something good is called a company. Tell me, why do you need to hear something unique? Because, you know, there can be thousands of people who gonna create calculators, and they're gonna call it calculator. And, you know, there can be thousands of people from in our around the world that will use the same word. Ah, with the application name. And you know, the school lead to some problems right on. You know, component on my must be just unique, unique to you. And because of it, it's gonna identify your applications. Okay, so here is the unique name for my Polish website. But I will use, for example, here the English ones, video courses online that come and it says that it is, you know, in the sub bombing of commercial commercial video courses, a lined up and here is the name calculated. And this this package name with the application name is gonna show now in the Google play, sir. Right. Oh, that's that's pretty interesting with that name. So in the future, it's gonna sell under this name. Okay, so now when we click next, as you can see here says here we have got some information like that. So, like the form factors your application when Iran up, it means select the devices your application with random. Okay, because different platforms may require separate a software development kit. Ah. So let me tell you what this as decay exactly. But before we go into it, let's look at what plot falls. You can run android so you can run Android on, for example, formal tablet and will focus in this course from this section. You can also run them on the we're Where is that? Clocks that you were on your arms, right? You can use it on the TV. You can use it in android out in the Google glass. But we want focus on this part because, you know, it's for similar and ah, well, I want to focus in this course mostly in in how to I think in Androids to do how to create whatever you want. You android. So they're OK. I want toe Digeo that's killed. Be able to do whatever you want, okay? I don't want to focus on, you know, every possible function that has ever been created the gears It's not possible Even I would like to you if I said something like that if somebody said something somewhere as he lied to you because it's not possible because there are just thousands of application 1000 of like prizes are gonna be created each day and and this is not possible to even remember all of them. I don't know all of them. That's not possible. If you want to become a programmer and I want to teach you in this course, you need to know how to look for the functions, how to look in the application programming interface. So in the a p I and choose the functions that do you want to use. Okay, so we're gonna choose the former tabling the owner and here we have got very, very important thing Minimum software development kit version. Okay, Some of the Milton Keynes stands for as you can as you heard a second ago for sort of development kit. And it means that you want toe. Ah, you have got there a kid. So some kind of package for developing software, Right? So there are tools. There are libraries that you gonna use, and each off that as decay, as you can see, have has got a number for programmers. So 15 16 17 18 19. But, you know, for people who uses smartphones and they are called a bit different way, like, for example, kid got lollipop jelly bean while marketing must ah must be somehow achieved, right? Because a P I C 17 wouldn't look good or android 4.1. It doesn't look good also. But, you know, there are many versions off Android. And here we have thousands of problems that we will have to talk about the future or lessons also. But let's focus. Now, which one should I choose? What will happen if I choose these one world? We happened if I choose this one? Well, if you choose this one, you gonna be supporting approximately right now, 97.2% of devices there are active on the Google places. So it means that these guys you can buy your application, right? Ah, but if you choose disease wa ho, there is below 1% of the devices that are active on the Google Place, or so, well, even even create application like that. That is gonna say, Hey, menu sdk for this Ah, application is 6.0 for now, You're not gonna achieve much money, right? So it is not a good idea. But if you are using and really popular 6.0, you can use the latest happy you do not need to worry about. You know, all old Androids, about how it's gonna look there, how it's gonna work on other things like that. So it's really, really cool. But it doesn't mean that if you choose for example 4.1, you cannot use totally things from android 5.0. You cannot use it on android 4.1, right. But you can use it on android for 5.0, because if you say minimum as decay, right, if you support menu as decay, it means that you gonna support also 4.24 point Faith for 4.45 point zero and someone right ? But if you use and off the new features that are coming from new versions, right, you have to check if the guy who is gonna use your application has good. And you android, for example, there is something we'll discuss a toolbar he enjoyed, for example, 5.0, and it is not supported in, for example, 4.0 point three. And if you want to use it Hey, go on, you can use it. It is an additional feature to your program. It's not gonna show on 4.0 foreign free, but it's gonna show on for 5.0. But you have to, you know, make loads of CO in order to work to make it work. You can also use some kind of super libraries. So libraries that were created using the application programming interface 15 to you know, a chief something similar to the two bar from android 5.0. But you have to create, then loads off more and Marco so you can see there are lots of problems because of it. You can create here. Kalbe chooses this. You can see here you will see how for for now people are using Ah, Android versions. Platform versions, right? Right now. And for example, leave you choose the for example from 4.4. You're gonna support how many's 62% people. Right. So we're gonna support 4.5 kitkat lollypop lollypop pop pop on the marshmallow. 6.0, right. So and men and and the new one on the right side Here, you can find out about what is new in version. So, for example, in android 5.0, you have got something like lock screen notifications. Oh, that is additional feature, right? You do not need to notification about everything, people. This is additional features, so yeah, you can use it in. For example, even though I mean, you can ah, you can choose the 4.0 Android platinum version if you gonna youth locks, grunting screen notification anyway. Why? Because Well, you just not gonna show to people who are using 4.0 android 4.14 point 24.34 point for you just gonna show it on. The two people are using 4.0, right? Ah, eso It really depends on how much time you have. It really depends if you are doing application for yourself or maybe somebody as you goto, among other things like that. Which version you wants to choose? I think that it's best idea at this for now to choose 4.4 at least. But for our programs, we for our cars we gonna choose 4.0 K in one off the lesson. I will show you how to support, you know, older versions, how to use support libraries and other things like that. But, you know, if I had to do it in every possible lesson, we would have to focus on it on the thing, so it would be just lose of time. Right? So let's first focus on using the newest features on old features also because, you know, old features are also available in the newest version. Right? So we do not use for input 5.0 in our situation, OK? And then we just go knock Lee next in desiccant. See? Now we have to choose something. What is called activity activity is just the screen that you see on your smartphone. Why it's good activity because, you know, we can only one activity at one screen, right? You cannot do many activities at one screen you have got always when you swab on your smartphone, you gonna You gonna goto another screen right to another activity, and you gonna do something else, Another activity there. So that's why they called the screen activity s so we can choose, for example, blank activity. Now, here we could next here, we should name our activities. So we're gonna college, for example main activity. And we're not gonna change anything. But when you changed here, as you can see Ah, the name here, you gonna change. Also, the layout, the and many results thing. This is the name off fires that are connected toe this activity and this activity name is really the class that is gonna be created with this name that is gonna represent the screen and lighter in the future lessons we gonna added it right? You're gonna add something to it and layout named Fight. And many reserves named five fights are also places. What we do that we're gonna talk about in future life lessons. As the name suggests, these guys about the resources that you can ask, for example, images to your applications Layout Name is about the layout of your application. Here you can call your ah activity because if he called every activity main activity and you had more than, for example, tell activities in your applications, then it will be hard for you to, you know, choose Choose them from job dumb money later in the in your project so you can call it whatever you want, right? Right. Whatever. And I will meekly click finish. As you can see, we are creating our first project and we can wait a second. You can see here we have got some preview manure and we can run this program am elated and other things like that. But the oldest things we will talk about in the next lesson Thank you very much.
65. How to change theme in Android Studio?: Hello. Today I will tell you how to change the team off the 100 studio. So how to change? Coloristic off your idea. In order to do it, you have to go to the file, then to the settings. And as you can see, there are lots off settings you can choose from here. But we're gonna focus in this. Listen on the pirin and you have got here something with this called user interface options . Here you have got something like team. And as you can see by default, it said toe Dracula. As you can see, this is very dark team, right? And I really, really like it. And I really also want I would like to invite you to use it. Why? Because it's gonna save your eyes, OK, Why? Because when you're looking at white color for very long time, your eyes gonna get hurt. And you have to remember that as a programmer, you're gonna spend programming loads of time. And if you want toe have your eyes healthy, you should use dark teams. Okay, But you know you might not like Okay, you might be I don't care about eyes in a way so then you can choose, for example, that entirely J and not when I click. OK, as you can see everything. He's so pride. Okay, it's just up to you, right? They would you would you want to use Now the code looks different right on. We can go back to the Dracula and you can see it's now dark. Everything is different, right? I prefer Dracula organized Dracula because I think that the health off your eyes is really important. And that's how we gonna use it in our future lessons. And well, you can, of course, change here. Many other things just read. Would you can change the right because it's just up to you. If you want to cast on your appearance of your idea, you have you here, you can do it. This is just easy. You know, you can just click thick and just an ticket, right? Uh, let's focus on more important things. So I invited to the next lesson, That's all. Thank you very much.
66. What is SDK, How to update Android Studio: Hello. Today I would tell you how to update Android studio and its software development kids tools . So we know to do do it. You just clip cap, and then creek your check for update it. Quick update now and everything is gonna update, as you can see updates on a very before android studio. Ah, software development kit and toast and it ensure you have the latest features and enhancements. So it's very important to download. Right? So you're just gonna kick update now and everything is gonna be okay, but unfortunately, it's not enough. Why is it so? Because when you go to, for example, the website like that? As you can see, Darman diversions off android, right? Um, and when you look at this table here, heaven three version, time off release appeal a level name and build version code for program like us. As you can see, there are 23 versions since 2000 and nine in 2011. When you look at here, here on 23456 versions in 2011 Right now it's a bit slower, like two versions per year. But still, as you can see, German updates to Android. Right? And you need to update to the newest version. But you also need to support all the versions of the Android. Right? Okay, so how to do it? You need to download the older AP A. You need to download all the platforms in order to do it. You should go here to that guy here as the came a natural when you click on it, As you can see now we have got on the android six point point 6.0.0. Here I When you click on show package details. As you can see, Android 6.0. Platform need toe update is, uh, here we way. We need to have to update its for something with this cult system image and Google copies. What is good apiece? Guppies is, uh, needed. If you want to create some applications using the Google services like, for example, Google ups, right? The system image is used for emulating the smartphone because it's not possible to have every possible smartphone righted every possible size of smartphone, every possible version off smartphone in your a room and then test everything. Emanuel. Right. So we have got something. What The school system images. And as you can see, we can update it from here. Or you can download and other system images, for example, for enjoying TV and and so and so on. But we'll talk about system image. Image is more in the lesson that will be specific for emulating. And he would have sources for Android. So, you know, it's good idea to choose at least when we look for example. For example, 4.1 right, uh, does and will likely apply everything from here is gonna be installed about system images you can true system we just manually because, well, you don't need all of them and really takes lots of time to download all these things and install it. So that's enough, right? You click, apply. It's gonna install it. It's a good idea to update your android stood yourself. Help check for updates. Click here and the this is gonna be checked. Also automatically. So you gonna see here? Um, very big. I told tape saying that. Hey, you know, it's a good idea to update your android studio, so when you click on it is going to update it, you gonna see it also here. Most time it's gonna inform you. Hey, you know there is a new version. You can also cook your check and then update now. So you know that you do it. You know, you just got date now is gonna update. OK, so there's nothing card and if you know where it is 30 just cricket the updated and you need to remember always keep everything upto. Let's go to sdk manager again and let's go toe as decay to stop. As you can see here, you have got even more options that are connected to tools that they're gonna help you like for example, Android Super Library and read Simple Ribery's needed. If you want to support older, older version off android US features because you can implement many off them not all of them, right, because it's not possible. For example, implement blue tough in Veraldi Android version, which is it is not possible at all, But there are many things that you can support, even if it's only available in U. S version of Android. The problem is that you go have toe work in order to do it so that it's not so easy Okay, so he results of good Google USB driver, which is work. Installing this thing is gonna allow you to emulate your application that you're gonna create on your own phone, for example. Right, There are many other things, but if they are gonna be needed, I'm go national. You show you how to install them in the specified lesson. Okay, so for now, we cannot choose this Click apply, and we just gonna let it install. Okay? Ah, I would do it later. I would like to also also show you something good is called lunch stand alone as decay manager. And because, well, this is the standalone application which you can use to update also everything you can click on Abdi's and then it will Abit everything that is needed. Ah, toe the meats updating. And you can also choose you android studio versions right toe from hell. You can also choose your something good. It's got samples for as they investigate these. Very cool. Because if you choose this guy than you will see how professional programmer are creating, we're using us features some APS. Okay, so that is also very nice. And well, everything else is the same, right. But you can create, for example, new here, and everything is gonna be installed for you, and it's a good idea to do something like that. But the problem is that if you have very slow Internet, it's gonna take lots of time. It's also gonna take lots of time. If there is something, there is an update for even things that you never gonna use. So, you know, select things that I said about. So uh huh And always look at the child like that, right? So people toe when you're supporting Android Studio 4.1 wonder when there is 9% above 5% off people, then it's a good idea to support it. Enjoy. Withstood your version, right? I mean and right conversion. And now it's not about lesson, but it's a good idea to listen to it because he may be now like, Ah, hey, is that coast out to date? Because, well, maybe it's 1017. Know when you're watching it? Yes, it's up today because I'm trying to teach in, discovers something with this more important than newest features because so many people never may be used US features because they don't need them or, you know, they would just not be supported in all the versions. And there would be total for 10 tons of work and other things like that. That doesn't some features that are very often using They are there are gonna be shown right is the most important thing. And the thing that you want to learn as a programmer is how to connect all these things here. When you click on the button, you want to No, that somebody click on the button and then somehow, you know, reacted it creaking, right? You want to see where the guys in the mob Google map or something like that? You want Teoh know how everything is put here in the folders? What is the Gradel have to use these layout? Here's what are they? Will our differences between them What are these? We just text foods contain There's other things like that, right? I think this is more important. And when you know it, when there is just a new feature, you gonna learn, it's very, very far without any problems. So there's only lesson right for right now. Please update your mandroid still do. Thank you for
67. AVD - emulating virtual device : Hello Today we're going to talk about Android. Veto a device manager. As the nice suggests, it's gonna allow you to manage virtual devices. But worth are very to all devices. Well, you know, it's probably impossible to have every possible smart one with every possible Android version and with every possible resolution, right, it's not possible. That's why you can do something. What is called emulation off android devices and another to emulate and android device you have to use something Would is called AIVD Menagerie when I'm here. As you can see, we have got here a tilt IP Avery the manager. When I click on it, I'm gonna open this android view to a device manager. You can also go to tools and row it and then AIVD manager here. Okay. And as you can see, we have got here already created a View two of device, which is called Nexus five with the A P I twenties free, which is android six on 86 something like X 86 processor. What does it mean? Soon? You know, it has got the resolution the full HD and it has got 422 100 dp I which I will talk about later. And well, it has got some kind off other properties like sites on the days Scipio A B I would talk about its own and it targets Goto. Happy is what does it mean? We'll talk about it. But there's a 12 device. We have some kind of properties like that, right, and you can now emulate it. What does it mean? That you want to emulate it? It means that do you want toe imitate every, you know, instruction off android Ah system. So in order to do it, you just gonna click here play and you know, emulation process takes those of time because they said you have to imitate every single Koeman came. So as you can see, it's taking loads of time as you have probably noticed. Also, it took a bit too much of my recording space. That's why I will also show you how to create your own hardware, your own device and we created a bit smaller. So it's gonna be visible in our ah, in our recording space. And as you can see now we've just emulated and android smartphone on you. Have you can do here. What? The very want You have that you a man and believe me at the bottom of this, Martin, you have got you know, the typical things. Like the messages, Internet, the camera and so right. You can do whatever you want. Almost every everything like you can do on your own. Smart. Okay, so you can even look in here. Oh, you can even talk. You right The door. Many, many options that you can use like a normal smarter. That's But that's why it's called emulation, right? You are trying toe imitate everything like the real thing. Okay, try to do it on your own, but please be patient. Because what? My computer is very good, and that emulation process is not so long, right? But for some people, it can take even 5 10 minutes is so you know, you have to be patient. The cool thing about this emulator is that when you open it, you do not need to close it. So let's try, for example, around these applications here from the that these designed by default one and create the project that's click here play. Okay, This bottom here and that was going to see. We can choose from the running devices demo later that we on just started. And now when you could go Okay, on we open hit that our emulated that I didn't close. I just minimize it. We're gonna wait a few seconds and and it's gonna take a few small seconds. As I said in relation protests take some time. Ah, unfortunately. Okay. Come on. Come on. Go. How? Okay. As you can see, we have got here our emulated application. OK? Hello. Or drive the toolbar here under things like that. So yeah, it's working. Fine. You have good here and monitor that is telling you what you're doing is you can see. Um, you have got here some kind off information about memories, appeal network and other things like that. Okay, Uh, so if there are in the Narrows, you're gonna see them here. And so Okay, um, something is wrong with Maybe I change something. That's why I have two quick here. Clear cash could cause something that you might want to click sometimes. When? Hundreds to do have some problems. Okay. And well, it's working right. Let's go back to our android mutual device manager. And now let's create our own veto our device because well, as I said, you want to emulate your application on other android devices and on other versions off android dry because, well, you do not know how it's gonna work. Another underrate. Very so in order to do it, I clicked the in the left bottom corner button create you two are device, right? And now, as you can see, I can choose from man in available devices. Well, that's for example Choose nexus for right and let's Greek now. Next. As you can see now we can choose here, for example, and Marshmallow Android. We just android 6 April over 26 and we have got here a few weird things like X 86. Jeremy, I be these seven a x 87 exit 64 so Well, well, well, What the hell was that? Right you might be asking. Well, this is think is application Barner Beinart interface. But what is that? Why do we have four versions of Android six when I click here? As you can see, you have gone for each android very in. Right on this, You can see we can emulate every possible android here. Four versions, at least four versions, right? Um well, does what is death? What, In order to understand that you have toe know that smartphones have different processors with different architectures. Different architectural means different structure, off processing. It also means that the processors use different instructions, which are Komen's, and that makes your computer working like it is working. And this governments are written in binary code. And the difference between architectures creates a problem. Why? You want to run a program created for any android application you have tow emulate a device which means you have tow imitate every instruction from android processor architectures. This takes lots off computer power. And that's why every time when you want to emulate android device device, it takes so much time, right? And the most widely used architecture is called a r m. And this is that one. Ah, I r m a a B like Visa night. Okay, but smartphones have also processors created by mental which are called intel atom. And these are these guys X 86 x 86 underscore 64. Okay. And ah, well, intell atone architecture is very similar to the one we use on our personal computer. And that's why if you are using PC toe, emulate your android application, it's better to choose Intell architectures Intel A B I Okay, because these architectures are very similar and your emulator, we run faster. However, you should always it is when you are ready to publish your android application test. You're up on a RM architectures. So this one OK, because Intel processors are readily used Ah, rarely used okay. And very, very comparing to this toe the A remedies for now. And you might have a problem of your application on air A our architecture that won't be present on Intel architecture, right? However, the situation is extremely, extremely rare on the way. But well, you know, for emulation is send for everyday immolation. You should choose these one and at the end you should check it If everything is working fine here. Okay. And you might be asking also What is that thing with Google ap I If you do not want to use Google a p I which is, for example, Google Maps, You do not need to install it, right? If you want to use it and just don't move it. And so let's get a cure. Show Donald Able System images. Let's started by the target. And that's juice. For example, Morley propriety that we are It is very important to have lollipops. So for example, this one and we gonna download it for the entire because it's gonna run faster. Of course, you should download every possible android version. You want your android device to run. Okay, so this is your tasks to do? No, that's waiting. Why are we stopped? We okay, so as you can see, we've just installed Intel X 86 out on 64 system image. So we're gonna be ableto emulate that image off system and well, that's Greek. Finish. It's finishing. The installation process is you can see now we can choose the lollipop. Ok, we do not need toe shell. Donald Able System images now here, it's on our list. Okay. So I can click next. And now we can choose the name off our android virtual device. It this name is just him for us. Okay, So when we want to juice from Well, from here, right, we'll know which one way we are going up Emulate, which devised We're gonna I'm like on Well, here we can change again. That device, right? How is gonna look? And the game? We can change which version of our dried you want to run on here. We can scale our device so we can make it a bit smaller. For example, um, or we can use the auto and scale process that will just make it working. Good. You can use the landscape, view the portrait view. You can emulate the performance a bit better. You've used the GPO cause GPO on. Well, you can use both of these guys. Well, you can check which one is gonna work faster for you. This guy or this guy? Maybe it's gonna work faster for you if it was one of the options when you want to emulate your and device and you have got here also sometimes called device frame. So it's just a device friend. If that's the thing that these around the smart on, right? So if you wanted, you can choose it if you want. I don't want it. You can just, um, choose it so well. Let's do something like that here. Free dp on device one pixel skin. This thing is going on scary to make your device smaller. Okay, Because Well, right now, one pixel on device. Well, four picks is on device will look like one pixel on the screen, so it's gonna be smaller soon. I would tell you more about the Depay things. Okay, this is the density independent picks it, But for now, it's not important for you. I just can't finish and just believe me that it's gonna manc that device. Polar. OK, so when I click play here, I was stopped. Ondas You can see these devices really smaller, right? And what is even too small for? For the next five, it will be like something like that. So it would be better. But the problem. But sculling is gonna show up, Cem. As you can see, everything is very small, right? But this now we can see that, um there are buttons like that here and well, you can I see that this I am a later off device is really in imitating the real device that it's like the real one. Right? Okay, so let's close it and let's create another victory device Because I want to show your so that you can create your oh, hardware profile. Well, if you want to, you know, create your own resolution, your own device that this wasn't listed here, right? Because, well, it is not possible to these every possible android device. You want to create your own one, right? You can call it here. We just call it test for our test purposes. Well, will make it four inches. And we'll create here every resolution. That will be good for our testing. Okay, so 480 by 720 these how much? Romney want Teoh and be used by our test device. And here we can choose. If you want to allow hardware and navigation additional navigation, you can choose the D. V one. It doesn't matter, really. There are also some supported device stays like poultry landscape. You're going to support a support. Both of them want to support camera sensors. These I could one. So you should choose them because you can emulate GPS and other things like that. We talk about in the future lessons. And here is a defiled skin. I will not use any skin because I want to make this Carter as small as possible. It will not look. Oh, so his goodness, the one that we've already seen. But well, I'm gonna use it just because I want to have even the recording screen looking properly. Okay? Saying it's gonna cook. Okay. And now I'm Gomaa. Click next, and I'm gonna choose Android with the version 5.0 K then angle likely next. And now I'm gonna just three things. Okay, lets wait a second. As you can see No, we can run our new hardware. And as you can say, this device looks pretty different. As you can see, here are that at the show buttons that we did not enable they are here. But we cannot creek them, right? You could enable them If you want it, I don't need them. And now in every future lesson will start our emulator from this position. Ok? Ah, I will already have it. Have the device running and we just test our applications like that that you take here play . I would choose this guy here and I was stop the recording so you will not use the A precious time future on that. I would just show you the running app we have, you know, new features that will create right. And also, it's good to know if you have got the intell that when you go to the as decay manager, you can go here and don't want something like that Emulator axlerod or your devices will emulate it in faster. Okay. And that's that. Also very cool Feature. You have the intell platform. You can also, you know, don't want all the system images from here. But, you know, it's gonna be hard for you to choose from. Very, very Longley. So just don't know the one that you really need. Okay, so that's only good lesson. If you have any questions, feel free to ask
68. Moving freely in Android Studio: Hello Today I will tell you about the most important parts of Android studio. I would quickly go to every almost every possible thing Android studio. So you will understand what's going on Android studio. But I would like to tell you the few times everything from this lesson is gonna be described better in future is just a quick look at they're thinks in Android studio like, for example, the project fuel pilot and so on until okay, that's not so at the top. We have got ends in an big program menus and there are lots of tools in their life is empty concrete. And if I open new fire, reopened the project. Close the project. These very self descriptive. Really, If we need something from here, we're gonna use it in our in future, and at least you will understand when you should use it. So we were not focused on this part. The second thing is the top bar at the top bar. You have got this shortcut to, for example, as we learned as they came in a manager to, for example, a video and not your brother. Also, things like you can, for example, play a Your device launched the emulator, right? Right. You can, for example, make the project so you can compile the project we've out launching your application, right? And, well, the dark just shortcuts. And if you want to move no more about them, you can just, you know, choose one of them. And as you can see, we have got a totally that say, say, when you could get you in part by something. But you know, there is a shortcut. Control plus V, you should have already knew. Okay, so that these are just shortcut battles. But now let's go into things that are new. So here we have some kind off puff path to where we are at the moment in our project. So as you can see, right now, we are in the accountant Main XML is a five from our layout full term that describes the lay also how things co exist with each other at our application. OK, you can use this path toe quickly, go toe another place of your projects, for example. I want to go to the resorts full there and then go to, for example, many and then I would choose the many main XML you can see now I'm here. Okay. So you can quickly choose something in something. Think from your project here. But also you can use this and draw it view of your project to go to, for example, that many and then go here as you can see when I change something here. It also changed it in this. If you do not see these project view, you can click here or if you do not see and I think you can click here. And as you can see when you do stuff like that, every possible, um many like that is hidden. So maybe cricket by mistake. But you can also critical need one more time, very slow. And you can, for example, click your project and then it will reopen your project. You can see this how you can close and open in the game. Bob, let's focus on this project. Mandel in game In this project, As you can see, you have good many folders. But all these folders are connected to enjoy it. Creation nation off for creation of android application. You can change these view. Too many others will focus on Android and Project one when we go to the project. As you can see, this is the true structure of your project. You can go to the up, for example. Then go to the build and here fights that you should never change. Okay, Because if you change something, carrier program might stop working. You can click Ah, here with the right and miles and go to the showing Explorer. And here you can see all the things from your apple cane. Right now, we didn't generate anything because we didn't run our up. But you can go, for example, source. Main resources. And as you can see, here is our layout, so we can change everything also here. But, you know, idea is just helping you. And then you can go to the source fight in Maine, and you have got everything here from the view off android. Okay, these the results is so the thinks like for example, do away will think so. Images layout, as they said. And this fight is gonna describe the layout of your app. Manu, that is going. That is the fire that is. There are gonna be fights that are gonna explain Many meet the mob is gonna so a So you can see these are some kind of images that are gonna be shown Ah, as an icon for your application. And then you have good the folder to discard values with, for example, Colores xml Dimensions String style. These are some kind off settings for your applications. Like for example, you can choose the primary Kohler for application, and things like that are written in XML. If I that I will talk about later as you concede our fights like exam ill and shortly these are fights, the text fights that they're using the extensible markup language. So it's using something like stocks and attributes toe talk about thinks in your application, OK, and this is mostly used only for describing your up. Okay, if you want to program, you have to go to the folder this good job are then go here and then, for example, choose this fight. And here we have lots of code that was generated because we used the wizard set up on and it was generated by it. We're off course, talk about that coat here in future lessons so as you can see, uh, you have got to places you have good place. Where you gonna just talk about your layout? Right. You're gonna create the code for your layout and you have got another place. Where you gonna coat this layout? Where you're gonna create some Alderete right is very important. And as you can see, you can jump from designed to text preview. And when you are in the text one you have to just write things here on Dwell hope that everything works Fine. But if you choose here the preview thing as you can see, you can instantly see on the right side the preview of the XML five that is here. So ah, when I click on text because you can see this thing is getting highlighted Pretty cool on defy add anything new. So if I go, for example to design view and then I adhere and you madam text, then as you can see, when I go here, the cold like that was generated. And now off course. Also, when I choose the other guy on your layout, other things are gonna be highlighted. It is very, very useful for the bugging of your applications. Okay, so if you do something like that, you're gonna just create another text view on bond can change the tribute. We have to change their trip off I d. Because this attribute describes that's an attribute, the unique identification er And as you can see now, have you two guys like that right It is not, Is that in the design view, you can change the place of things right In the Previa window, you can just click and see where finks are spotted in the XML file, and that's all. You cannot change the place of it. Okay, that's very important. The also important thing is that when you put something or you delete something, it's gonna be also deleted or put until the component tree here component re describes how our components related to each other. If you did something in photo shop, this is very similar to the content that is called Liar. OK, and there are just liars and you can create many liars. You can have many related layout next to each other. There they can be in one another. However, let's not focus on this because after this lesson, you should just know where things are played. So when I click on and off that I think, ah, owner that component is gonna select and highlighted on the design view. And as you can see, we have got here. Also, something good is called properties. So the things that are describing attributes that are describing your baton or your text so you can find any property and change it here when you click on properties. Just the focus in this manual. OK, And when I just stopped typing, you can try to find something like, for example, coal Or and while he's not the shadow color, we want to, for example, change but just the text color. And when I type here something and then this color is gonna be applied. If you do not know how to apply, you can click these free buttons freak dots here. And so now you can easily choose the cola re wound. Like, for example, I know read write only can choose one from the static one from the colors that are, you know, already Reggie starts to some kind off Hexi decimal values. Let's choose the right one. Okay, that's great. Okay. And you can see now with right and wouldn't go to the text. You and witches That guy here. Ondas, You can see we have been now here and in tribute. That was added automatically. Okay, so that's very cool, right? You can choose easy from the component 31 of the compliment that have been just added. And then you can change and the property of it without going here. Okay, this is school because, well, it's got to remember where possible property. Right? And well, that's how you use it, right? And there is one more thing you should know about Is that preview place here? You can, for example, in large to have because right now this is card, right? It is minimize. You can make it like I would look in real life. For example, your app on a device. You can change the device. You want to run it on, right? You can know running on even android TV. Whatever. So you can do something like that. You can also, for example, switch to landscape so you cannot see how it looks like in the landscape. You you can also, for example, preview all screen sizes. Hey, I would like to see what's gonna happen with the elements on my type of layout on other devices and so on Sound right. Let's let's Greek here. No, none. You can change tear. Gonna be able, for example, change and translate your up here. You can check your android up on other versions of Android. Tried How How it's gonna look there and well, you can see there are many things to Dio We're gonna do them in future. Let's also not forget that we are using the I d to make our life easier in writing the code . So if you make even a small mistake, it's gonna be shown as you can see like that. So also, even if you did not notice something together, that mystic is gonna be harder to spot. If you could hear on the make project and we wait a second, we cannot see something like that are that's semicolon is expected when you click on it, we gonna jump to the place. Okay, So even if you are in another five and you do stuff like that, you're gonna jump to the place where these are a cart. Okay, very, very good Yeah. Good. Also, something good discord and drawing monitor where you can read the locks off. Your application is used for the bargain that we talk about the future on. Do you have got also something What is called a Gradel Gradel is something called this, um, helping you just build system. So it's gonna have information about how to build your application. Like, for example, um, here you can specify the new moon as decay version. You can choose some depended dances. So there libraries programs that need to be compiled so added to your program. Otherwise your program will not work and so well and so on will talk about how to add things like that in future. I think these are the most important things that you should know other diseases. And and as I said, we'll talk about it even more in future. That's all. Thank you very much.
69. What is XML and how it is related to Android apps: Hello Today I will tell you what is examine and how it is related to programming to creating applications in Android. Let's start from basic. I've just created at text fight, so it has got an extension. They x t But you might be thinking, Hey, but hey, we should be talking about exemplifies these were collected topic. OK, Why? Because the XML is really something good is called extensible markup language. Okay. And what does it mean? What does language language means? That somebody is gonna contact with somebody. And there are some kind of rules of contacting, right? And this rules, huh? Makeups makeups is really tax stocks that can be extended that can be invented by you. So that's invent something. So let's say something like false card okay, that's assassinated. Let's get more than one pulse cuts. So this thing is called talk. Okay, this America. And in order to start that, you have to use this sign here. And in order to nt stock, you have to use this thing here. And between this stock and the closing attack, you can define now postcards. Thank you. Ok to something like for some kind. Let's create another postcard. Um, let's for example, um have datum about the bull Scott. And let's, for example, inside these data. Half name, for example, My name. Oh, that's good. Sound name. So, for example, my surname Let's go up it on. We could create write you another guy, right? It's up to us. What we gonna create here? Because it is called extensible markup leverage. We can invent your own markup language here. Okay, But you have to They use some kind of rules, right? So you have to create a paint us closing tax, right, And you can give, for example, additional information's off. Example. This postcard is gonna have a color, and this is gonna be color in rats. This is gonna be calling, for example, yell, right? It doesn't matter. We just inventing it attributes, attributes is just additional information about compliment about the talk about elements, right? Whatever you want to call it. So we've just invented something like it, and it really doesn't matter. Ah, what it means in the text five. Because now you have to invent you have to create an algorithm to interpreting. Okay, so here we have an example. Five with with targeted school related layout has got many attributes like patting bottom padding left life Example text That's color. Which is gonna say what is gonna be the color of the tags view and someone zone and all this xml five is gonna be interpreted by that program by the algorithm that was created by somebody, right? It's gonna just interpret everything and it's gonna change this text five in tow, this design. So the cool thing about exam if ice is that you can define here something using some kind of rules and create your own Ah, tax, right, right. And attributes Well in Android, we know we won't be able to use our own tax our own attributes. Well, we could create our casting one, but it is advanced stopping, but we can use from the one that are already interpreted by the Android program ago. Android Al Gore is right. So if we wanted, for example, changed these two weeks Emma five. Who just to change the extension? Okay. And we can open it with note pad, right. And we just need to delayed this thing at the top because, well, it's just a simple text, so it is not gonna be interpreted by the rules off Extensible America language. Right? So we have to delete it. We should also do something like that. So we should define what XML version we gonna use where it is here like that. And we should change the four month Teoh coding in utf I'd like it's here, right? And we just created our own exam a fight that can be interpreted by others. Ah, and well, that other people knows what with postcards mean for them, right? We know what data will mean for the name and something. They will interpret it however they want. Okay, So mm, Android programmers know what is related layout for them, and they interpret it so they loose like that here. But still, you should Don't know. Probably. What is that thing that XML on s and that column here and to, you know, android column layout with Why do you have to add before each off attributes something world is called android or AB or tools? What is that thing? Well, this thing is called a nice, but what is the Nisman's? Well, Well, this is a spy's. These despises called the space I discovered is gonna be called B and nice bases Justice space We've named. So, for example, with the attribute names, right, that's true. We have good layout with their height, right? It's a nice, but it isn't the nice man that this called Android, right? That's think that this is Android that nice space, right? For example, and on drawing nice place. We have Goodman and tributes like, for example, when I designed, like, a dead android. And we have got here, for example. Background. Right, So we have good there. For example, Beggar, Let's try to ride it here with my superpowers. Okay, that's a question that I just I ah, written. Here's something with this Got back hunt. And the cool thing about spaces is that when you create your own one, for example, being you can now also create something here something bodies called Bagram, like another attribute called Bagram. And because of it, there are not gonna be problems with, you know, interpreting later, right? Because this background is inside these names with this background is decide these names space and if and they can co exist with each other, right, because we know from which one we want to Ah, take background, right. This background could be interpreted by one program different way. And these background could be interpreted the different one, because off this name space because of the definition. Example on as column android, We way we can create our custom attributes that will, you know, be called the same like the one that are used here like petting, toe petting, ride and so on. But they will be in our own name space. That is why they created something like name spaces here. And as you can see, it points to some kind off you r l, but well, this is just here. So you know, when you change it here, it's not gonna work it all. This is some kind of just unique identifier. That's all this website could have put in Shell is some kind of description off the attributes off the tax that you can use. Bob, they didn't create, but for now Ah, this is just the something like and I know unique identifier so they could do something like that, right? And this is union. But they decided toe type here, some kind of domain that these unique for the And now, because of that unique identifier on the program that is gonna interpret this XML five for creating android applications, right it's gonna use it has a re friends, right? So you have to add and draw it and then the column, because otherwise is not gonna work. Right, Because the interpreter doesn't know the layout with without this the nice base here. Okay, so the interpreted the parts service called Parcel right is gonna go line by line. And if she knows about layout with its nose on the about layout with that, this from this nascent. That's why you have to add Android column. And, well, you know, of course, you because of it, you have got also very good and easy to use. Um told tips right tonight that took the Apollo. Okay, so why is somebody bothered to do something like that? Created that design in the example five and the coding, Another fight. That's because huff, that I be that's because of the thing that I have just said toe sleet, the exam. If I and the Java find their street ID now, right, so the colder can focus on called on the Person Who is responsible for creating Design. The person who has got the ability to create a nice design can just focus on creating reason. He doesn't care about coding. So two people can work on one ah, Android applications with different skills, right? And that's why it is also very cool, right? So you can just, you know, control. I control C and copied, and somebody else can use your layout. That is very, very cool, right? He doesn't. It doesn't matter what code was written behind because you can create your own one, right? Just for the reason that that's really, really, really cool. And that's why it was created like that. So in the future, we gonna learn talks. We're gonna learn at reduce the do you can use. And that's only the lesson. Thank you very much.
70. Activity and Views: Hello, my friend. This lesson is very, very important. After these lesson, you will know how to get compliments, wages, layouts, whatever you want to call things that are placing this palette from the view. So from the place where you can see it, right. So when you're creating, for example, in the XML or in the preview window to your couch, So you can finally, for example, do something with the driver girls? A. When you put something he killed, for example, a button that were, for example, have a name, right? Right. Like next quote, you want to see another activity, right? You want to see another code or something like that, right? It really depends on what you want to do. But you want to react of things that happens. The somebody do with your application. And in order to do it, you have to know how o these things work in background. Okay, Before we do it, I want to tell you a few things. Okay, So anything from this palette is really a view. Okay? Why do I think so? Well, when I go here and for example, we have got to hear a text you and I when I, uh, use a counter shortcut and then I click on the text field. As you can see, we can see the closet text you. And as you can see, it extends the view. And when I click on it is the last class J skulled view. Okay, well, let's check the related layup view group view. Okay, so everything that is put here, it's really a view white school view way, because you can view it. Okay, So any lemon that you can view its place in the view class. This is very useful information that we cannot use. The next thing is that when you put something here like that, you not only generated in the XML, but he also generate some kind of real reference. Okay. Inside the R class, when I used the shortcut control chief plus 10 and I top type Arda Java kit enter. As you can see, we have got ah generated class, which we should not change. Right? This generated is gonna be changed every time you at something new to your view, for example, and as you can see, do not modify. Do not do it because you can have problems with your application later. He's got gonna generate every friends that you can refer to later. From your, um from your main activity. That will talk about soon. Okay. So you might be asking yourself What is that? Our class and the white skulled are It's called our because it stands for resources. And as the name suggests, it has got all kind off resources inside properties that you can access from this place here from the main activity for exam. Okay. And, well, you should know that you can access it using for example, when I double click, for example in your bottom. When I find I d here using these name, you can change it. Let's change it, for example to next quote baton. Okay, so it would be easier for us to access it. Let's change the text also to, for example, next quote like that. Okay. And as you can see here also, this didn't pick. Attar is strong, right? You can You do not need to. Well, if you do something like that, it's also gonna gonna generate inside our class. Your identification, sir, that you can access later. Okay. From the exam if I you can do it also. Okay, So? Well, now we know this things. We should go. And somehow access is okay. How to do it. Well, we need to know a few things about activities before that activity is just a screen. Okay? A screen that you can see that you can use that you can play with on your for example. Smart. Okay, that's the activity that activity has that something would is called life cycle. And the first cycle is when your activity is being created. And this method on create is gonna invoke every possible instruction here when your activity is being created. So when somebody just open your application, okay, before even showing it to your that user, it's gonna invoke these instructions that will be placed here. Okay, so this is like the main method for the java. Okay. You want to put here the cult that should be executed as the first and the most important coat to create your application? We'll talk about life cycles later. What? You should putting world cycle on the other things like that. But this is a basic one. Is when your application is being opened. Okay, let's talk about this own create mattered a bit. It has got one perimeter that stores information inside the band with sun. Package on this package is called Safe Instant State. You can use that Bandel that package to send information between man activities. So here in the first line is very important line because if you do not use it, you are invoking their method that was already implemented in the up compact activity. You can go there by, for example, creaking Q and then doing something like that, right? Fake, Then go to it and go to declaration are using the shortcut control plans be. And as you can see, this method did something like that inside view factor. Whatever it is, it did something right When we go even deeper because it's concede they invoke you again on create method, it did even more finks, right? And when I click on this, it did even more things. And when I did something like that ended even more more and more things. Okay, so all this conditions on Del's these things that were done here has to be invoked. If you do not do it would have to, you know, copy all these things. All that coat here, Andi. And you know, we would need toe. Always check if the creators off the android ups wouldn't. At something new here, you will need to update your own, create mental every time if somebody create updated, for example on create meta t, right? That's why you just invoke here always that own create method that this in the higher place in the hierarchy. Okay, that's very important. Then you said the count in view using our resources class, and then you used to prepare to lay out toe activity main. So you said it to this XML fight. Okay, so this is the first thing that will be shown, and this will be set. This our first of you then you have been some generated things we could, you know, delighted. Or we could just look at it and get some information about how to code in android. And these metals are also created. You can remove them, or you can, you know, use this to, for example. Okay, there is a method that is called on create options minutes. So also it's gonna be involved when the options menu is created. Also, I can at some items there. That's how you should think when you are programming, right? But we don't need this bet. It's We should focus on create method and we want to now get, you know, want to search for the view for the compliment from our content main XML that has got I d The discover next cold bottle And we can do it very easy How we can just type are dot Then I d Then access, as you can see next code button And now we have got it. The problem is that this is in teacher right when we go to the r class control shift Plus And as you can see, everything here is intelligent thing. So we need to sometime translate this into jer using the method that was created in order to do it. And this method is called find view by I d. So you send only this idea either and this method is gonna take care of. What does it returned this matter? When we go into it, a zoo can see it returns view and came as I said, area every everybody in text. You every layout, whatever is really a view. Okay, so the returns of you so we can do stuff like that view. Um, next quote baton it calls. Find view by I d like that, right? The problem is that Hey, I don't want to have here view. Only I want to have acted toe every possible, um, method every possible property, that is, you know, created in the bottom class. Because, hey, I just got your view. But I want the one that is baton. So I'm gonna change the type you to bottom. But the problem is that well, we need to first imported the bottom. We can do it like, for example, clicking here and then import class when we cover on over that.
71. Listeners - handling events: Hello, my friend. In the last lesson, you learned how to get compliments from the view into your code into the activity using these line of code. Now it's the time toe react to interaction with your application. So you want to react when somebody click on the button, you wants to do something right. So you want to catch the even You want to listen If something did not happen in your application and that think that the lessons that you know interaction with your application is called listener. Okay, so you know didn't do it. You have to use the compliment you want to listen at, then use the top and used the method that this coat set. And then, as you can see, you can listen for many things. But we'll focus on this lesson on the set on quickly center. Okay, So you have to set the listener. And as the name suggests again, this think listens. If something did not happen in your application and in our situation, it listens. If the on click even did not happen, Okay, That's how it works. And now you have to send here the implementation off the method Ah, we just called on Creek. How do I know this? Well, I can do something like that, Control. Plus cook que When I double Creegan incomparable ask you and I can get the commendation of insurgency. I need here something with this cold view. Own click listener. Okay, well, what is that viewing clique this in them? Let's try to find out by, for example, do something like that. Let's tidy, right. You that on clear reason and there's just controlled plus BD and visit Cassie. Ah, view Well, view is the carts, right? And inside the scars We have got the public interface that it's called on Krieg Reasoner and inside of it, we have got the method on creek that is required on to to be implemented because that's how interfaces work, right? If there is a method inside an interface you are required to implement and everything from the method right from the in clique is gonna be invoked when somebody clicks on the for example, these buttons, right, So we need to implement it, how to do it. Well, we can implement this interface in the new class or we can, for example, create an animus Cross. Well, let's do it either. Where for a second. Let's do it by, for example, creating a special cars that will call for example, Um, next quote button class like that. And it's gonna implement this view Dunkley, Greece, and write like that. So we can now see that goes here and there because it says that well, must leader be declared abstract or it has to implement abstract minted on quick. So when I click here at the class name, as you can see, we have got here there error about, and we can create, implement all methods and we can choose which one want to implement. I can creek, okay? And we have just implemented it. Right. So now we just need to do something like that. You, Andi, next coat, but in class. So we just inserted here the object that off class that implements the view on Krieg listener. Right? And he's gonna work fine. We can Now, you know, we do some things here and it's gonna be shown when somebody creek on the neck Spartan because the listener So the guy that listens if something did not happen, that has been set and it's been set to the action. Later, when something happens, it's gonna do this action. There is also some generated codes. When we created our activity that looks like that, it's can see it searches for, Ah, the view that this cold like that and it is a floating action button was that well, is that think here, and when you click on it, we can see something good is called The snack bar. Snack bar is an object that is, you can see you can eat. It's like a snack bar, right? You can eat it on something like that is gonna be removed. You can also wait a second, and it's also gonna disappear. But you can edit right in its own right. Scott Snack Bar. And he's a class where you can you give some info to your user. We talk about it more in the future, but let's use these right. Let's let's check if our Cody's working. So let's stuff like that that you can see. We hear we have got their rat ero and says kind of results. Symbol view is because Well, here is the view is called V, not view. So you have to send it to you ve If you know it. Do want to know what you want to send that you just tied the counter plastic core idea. No comments, Blasco Mark. And as you can see, it takes is the first parameter view. Okay, so that's how we do it. On what? We can just run it. So let's stuff like that and then click. OK, And now when you click on now, our next course is conceived. Have been here. Replay it with your own action, Writes the information from here. Okay, so it's working. But you have probably noticed that these guys did it a bit different way, right? They and what the hell is dead That view that era where this thing is called the Lambda expression and when you click Plus, you gonna see how it's true looking like Okay, if you do not know what is not the expression, please go and watch. My car's about Java. You don't know what is anonymous classes. You should also go there because I definitely explain it there better than here. But I would try to again explain what it's another Skousen. How it's possible to do something like that here and why it's even created like that. Not like that. Well, the first thing is, imagine that you have Goodman and bottoms you will need to create for every button a class . Well, so you would need to create for every possible battle for every possible, you know, click even. Um, you will need Teoh create a special class that would just take loads of time. Right? So in order, if you do not need to that class for anything, guys. But for just implementation of this method is just no sense to create a class like that, right? It's enough to just create um, and the animal Scott. And an enormous class is just something that doesn't have named so like that you just type the interface. You want toe employment than you do something like that. I've just created ah, animals class without implementation off methods from this interface here so that you can see when I click here. I have got this Ah, read about and I can implement all methods like that. Now we're talking fine. I can, you know, do something like that again. You Is it snack bar bombing wings to just place here something for my own action. I can just Klay No. Okay, wait a second. I'm now click here, and this can see we have got this message now, right? So we've just created an enormous class we've committed here. So it's just faster now, OK, so that's how listeners work. You're setting on quickly, sinner. And then you set the implementation off the animals class with the method that is gonna be invoked when somebody, for example, click right. You can set many other listeners. You can read about them, or you can watch my future videos. And I wish you really talk about some other. Okay, so there is one more thing you should know right now, we are accessing the next gold button from this sculpt. Right? But the problem is that what if I wanted to have, for example, many methods here in the main activity and future? It will happen. That's because of that. You should always have the button and the other thinks that are taken from the view created as members. So it should do stuff like that. Baton. Next quote bottle. Okay. So is now a member of the property off the main activity. And, well, it's a good idea to keep things like that, private, because then you are following the principle, which is called encapsulation. Right. So in your coat is more closets another. The people are not gonna be able to, for example, get this bottom without the permission. That's all right. So it's a good idea to keep it private on do something that it is also a good convention to have your variables in android that are private and that are members cold with the suffix which is called I m. So you should do something like that that m next cold bottom. So from its stance and m is short for member. Okay, Andi. Well, you askew have notice when I change here something I should have also changed in other places. So in order to change, it demanded places you can using android something go. Discovery, factoring you can go here, re factor ring name, and then you can judge, you know, stuff like that and it's gonna change it in every possible place. So that's how I just done that. And because of this approach now, when I create another method. And in future we will I will be able to access this button from also other places. Right? I will not be stuck on the this matters. I can't is very important. I think it's good to know it. Okay, that's all in good lesson. Thank you very much.
72. Faster button event handling: Hello. In the last lesson, you learned how to react the most frequent even that this gold click. When you click, you can reacted and show something to the user of Do something right And you did it the hard way using this unclear Greece inner and then using the anonymous class and so okay, but there is a very simple way to do it without even knowing about anonymous grasses. You might be angry now, but don't worry. So I will tell you why you have to use sometimes dis approach and why I started from teaching you these way. Okay, so let's go to end. Let's create another button against the leads to something like that. And let's, for example, create important. It will be called previous quote. Okay, so we want the previous coat right now like that, and we're going to get the design. Set them like that, for example. Right. Okay. And well, we've just created a second button on how to handle the previous quote part. Well, we will do it from the XML. I was type now, Andrew, it name space, and then I would just use own creek attribute. And now you just need to think of the name off method that we handle the even. So, for example, previous quote Barton click handle. OK, so, handler, it's something that is howling that quick bravest quote bottom. I think this name is said the script. It is gonna be good. And now you need to create it inside the activity. The disconnected to this XML file. You can do it manually. Oh, you can just go hit here and click create on quick event. Other click OK, I'm dizzy Quincy. We've just created method where you can put for example I know another snack bar right on safe here something like I am from previews code bottles. So we know that this is that one on hearing to change the name of a rebel because it's different now on Dwell. That's that's all. We just want to run our program. Okay, now let's like previous quarters, you can see it's working. This one is working and now you might be like Now explain to me why Why did you talk about set on klieg listener? When it's so is Well, there are a few reasons to the 1st 1 Is that look and Rohit. Colin, Um, good to see. Well, here, maybe Android. Um, you can see we have good Onley One even that we can handle from here. Okay, This is the main reason I told you about the click listeners because well, here, as you can see, we have access too many other situations, right? And you have to, you know, be able to handle all this even if you want to 100 them. Right? So it's good to know how to use it. That's the fasting. Are Martic. The second thing is that well, it's slower. Why? Because now I will tell you how it works. There is something weird is called a Java reflection. Java reflection is some kind of methods from a library, the disco reflection. Um, these methods can analyze a coat and create its own coat depending on what coat is gonna meet Cain. So that reflection is gonna read. For example, this XML file on. And when it sees something like that on click attribute is gonna want to find inside your activity that is connected to these XML fire. The previous gold Bottom Creek hander met it. And this method has to be like that has toe have the name like that. That's the first thing. The second thing is, it has to be public and void. And it has to have a perimeter like that came. It's not looking like that. It's not gonna work. And it has to be inside the activity that is connected to this XML fire. So this is slow, okay? Because right now there is a coat that is gonna write a code depending on the code that was created by you. Okay, so it is a bit slower. Well, maybe for creation off one. Ah, or maybe a few. Ah, things like that. Evens like that. It's not gonna slow down your program, but it's slower. Okay, on the second, that health thing is that, as I said, it has to be inside this main activity that is connected to this example. Fight. What if your program is gonna be in future? Bigger. Right. You're gonna have something with the skull fragments, which is something very similar to activities like a sub activity will talk about the future, and you want to have, you know, in many places ah, listeners. They will not be said in you don't want to have method like that inside, you know, distinctive ity, for example. Right? Then you have to know how to do it dead way. So, you know, if you have a simple applications, why not? You can just go ahead and do it That were right. Just do it that way and just kind of things and you do not need to worry about, you know, creating something like that just for the sake off. Ah, handing the even right. It's just taking a lot of time to create a private or a building. Getting the viewed and setting the creek is in there and then doing that when you want to just, you know, the simple thing. I think this is a good solution, but it's not a good solution for every possible situation. So that's why I told told you about that solution first, because this is the universal one. Okay, The Dylan did lesson. Thank you very much.
73. Layouts: Hello Today. I would tell you what our layouts layout is. A visual container that holds elements. It lay out things inside itself. Right. So this is a layout and each layout can lay. Thinks a bit different way. For example, lean our layout. We'll lay everything lean our way. So one by one. Well, right. You can see here something like that. It's one by one verticality. So it's gonna be from up to bottom. If he was the horizontal one, it's gonna be from left to right. It was, for example, related layout. It's gonna be related toe something. Every element is gonna be related to something. So, for example, this previous gold might be related to this next quote. Or it can be related to this frame. Or it can be righted, blah, blah, blah, blah, blah, right. You can, you know, do whatever you want. And now you might be asking yourself by Why did they create something like layouts? Why not to just put the element here and why it is not just there. Well, because there are many different types of smartphones, right? They can be different size. They also can have different resolutions and so on. Let's juice from that men option here, for example, Android TV. And as you can see, these two buttons are still almost in the same place. And that's because we are using related veil that is, you know, trying to have everything related to something. That's why things looks very similar in different versions off your smartphones. You see, this hell award is at the ah, the in the middle of the screen and on the TV. It's also in the media, right? So it's very cold because he can, you know, put things Les Finks inside your inside the layup, right? So dark, different ties we will, you know, learn about in the them in the future. Let's go to them from the design to text view and, as you can see when I click on the related laid out and I use the contra part alas, h a bottle. As you can see, we have got here something go this called hierarchy class related layout. As you can see it, we can see how, um, the inheritance works between all these classes. So we have a related layout. The look of you group, the look of you. And of course, object. Object is the supercross off every cut glass in Java. Right. So layout, uh, almost views, but they are used for grouping views. Right View group that when you read the name of crowds, you should know what's gonna happen. Right? So inside related layout. So inside a lemon like that, you can see here we have got the opening target here. You have got the closing talk. You can put manner elements, right. Many view of so views, single views, right? So, for example, text view, but in button and many others. Right? So you can put them inside there, for example, related layout. And because these related layout, they will behave like that. They would They were related to something. It did not set that they are gonna be rated to something. They are generals. I was gonna you know, when I know it's company days and something like that. And as you can see, um, it's probably here in the same place. Right? Um, when we, for example, to stuff like that Oh, you can see it's under date. When he added a few more things here, it changed a bit Well, of course we have got the same I d We can change in Baba Blah, but well, we'll talk how this layout works in future. Most important fact value is now that every layout is really, um, extending the view group and it can hold many elements. Right? And all the elements will behave according to how the rules are set for the specific layout that we'll talk about in future. Right? And you might be also wondering that why we have got something like resources and then layout and to fight, see why we have 25 year. Maybe you have one like here. And this is the basic layout related one. When you do something, I created new new project the next. Next, and you create the interactivity, you're gonna have the situation like that. But if you creek other one, for example, blank activity or many other they the idea is gonna generate some code for you and one of the generated code. It's called activity main example fight. And here you have got all already created some layouts, and inside these layouts, you have got also your content. He would have got something like include Zach. That includes, as the name suggests, a layout and you could refer here to the content meant Soto, this one. So activity main is just an example. If I that has got some additional information about your activity while very important one like, for example, toolbar education. Better layout coordinator layout tried floating action bottom. We talk about these things in future, right? But what it holds the content of your, um, off your application. Right with that, we've just these one line. Okay, So he would have got the content main examine and inside the content in X Emel, we have got thinks that our content of your applications. So, for example, text view right button button in with a related layout, which is the parent off the elements. Right, So this is inside the activity main. Okay. On divide the wondering. Why'd they separate these two things? Well, because of it, you exactly know where to look for something. Hey, I'm looking for the counting. Okay, So the content is here. I just into it. Some of them it's OK, but I want to do something with the toll bar. Okay? The toll bar and things that are, you know, generic. Okay, They should be here or something like that. Okay, um, and of course, with dog about different types in future. For these lessons, this is enough. So go ahead and have fun. Thank you very much.
74. Layout Basics - Linear Layouts: Hello. Let's train a bit late. Leaner layout. Because, as you have probably noticed, all these lemons are placed next to each other from left to right. But world would happen if I wanted to have more lemon, like, for example, like that. But I would like to have in one row two elements. Well, the first thing that you would do probably change the orientation to vertical. Okay, so it's not from top to toe bottom. The problem is that I have got what, single item in vitro how to change that. Well, normally you wouldn't be able to do it because they know diabetes gonna place every element in age single roll on, that's all. That's how the leaner they are this working. But you can be a clever person. And for example, group thanks views. He cited another Rina layout. So, for example, you can do stuff like that. Said there were even hide to the size of the content and this I think that Okay, Andi, when we can cop it in game. So right now, as you can see, we have got world too items inside each row. Why? Because this this is like a single item now. Okay, this leaner lay out and design around is like a single item. And they are what place? Vertical ism from top to bottom. Okay, we need to also change what? The baseline lying to falls a game. Okay, so you and it's also something like that. And now it works. Fine, right? Okay, lets train a bid more because this leaner lay out right now is as big Aziz. You know the content that's changed the color of it. It's something like that. Let's change the color too green. As you can see, we cannot see it. Know why? Because it is just as big as accountant. But if we change them, for example um, we have toe 200 db How it's too country DP Because you have to elements of 200 GP. So let's change it to 300 bp. Okay, so, like that on, that's changed. Also, these in height. As you can see, these looks like that on this gravity. Here he's gonna what is going at center horizontally. So you know horizontally. It's cannot center these elements of these one and this one because good now this element. But it's not taking into consideration these elements here, right? So we could go inside these guy and, for example, changed the gravity to Central, and it's gonna center this 11th. Okay, but what if I wanted to do something with this a lemon and is, um, and like, for example, Iraq to have only these one here. I would like to have this guy here and this guy here. What would I do? Well, I need to probably said the gravity off the text view and the oldest text right on. Well, if I set the problem is that gravity is already said he right to center. And this gravity is referring. Toe the items to the elements that inside the text and these items these elements is for for now, for the Texas view on the text. So how to position this books up here? There's another attribute that this cult layout gravity, and now I can set it to the top, for example, and this guy I can set to the bottom. Okay, So layout gravity is gonna change the position off there. Element off the text view. Mm related toe the leaner lay out. Okay. Toe that you are the parent. Okay, so they are Gravity is gonna change the position related to the parent, but at gravity is changing the place or things that are insight. The element. OK, so that's the difference is very important to understand it. And of course, if I change these two, for example, wrapped content and here to wrap content, nothing will change because, well, right now, the layout gravity bottom means the same as stop. It means all the same thing all the time because the size off the layout gravity that it is referring to, So that that is related to sort of the leaner layout is just the same as the size of the text view that are inside. Right? So these just is not affecting mm, anything because it's not possible. But if you change it here to 300 dippy, yes, then it's gonna change the Tabor. This is gonna change it bottom or contributed center. It's all up to us. We're gonna do OK, so that's the difference between layoff, gravity and gravity, you know, know that you can, you know, group more than one leaner layout. Um, inside another leaner lay out because you need to just remember that. And the layout is just used for grouping. Okay? And every layout has with rules on these rules have to be respected by elements that are inside these layouts. Okay, that's only good lesson. Thank you very much.
75. Linear Layout exercise: Hello. Let's train a bit late. Leaner layout. Because, as you have probably noticed, all these lemons are placed next to each other from left to right. But world would happen if I wanted to have more lemon, like, for example, like that. But I would like to have in one row two elements. Well, the first thing that you would do probably change the orientation to vertical. Okay, so it's not from top to toe bottom. The problem is that I have got what, single item in vitro how to change that. Well, normally you wouldn't be able to do it because they know diabetes gonna place every element in age single roll on, that's all. That's how the leaner they are this working. But you can be a clever person. And for example, group thanks views. He cited another Rina layout. So, for example, you can do stuff like that. Said there were even hide to the size of the content and this I think that Okay, Andi, when we can cop it in game. So right now, as you can see, we have got world too items inside each row. Why? Because this this is like a single item now. Okay, this leaner lay out and design around is like a single item. And they are what place? Vertical ism from top to bottom. Okay, we need to also change what? The baseline lying to falls a game. Okay, so you and it's also something like that. And now it works. Fine, right? Okay, lets train a bid more because this leaner lay out right now is as big Aziz. You know the content that's changed the color of it. It's something like that. Let's change the color too green. As you can see, we cannot see it. Know why? Because it is just as big as accountant. But if we change them, for example um, we have toe 200 db How it's too country DP Because you have to elements of 200 GP. So let's change it to 300 bp. Okay, so, like that on, that's changed. Also, these in height. As you can see, these looks like that on this gravity. Here he's gonna what is going at center horizontally. So you know horizontally. It's cannot center these elements of these one and this one because good now this element. But it's not taking into consideration these elements here, right? So we could go inside these guy and, for example, changed the gravity to Central, and it's gonna center this 11th. Okay, but what if I wanted to do something with this a lemon and is, um, and like, for example, Iraq to have only these one here. I would like to have this guy here and this guy here. What would I do? Well, I need to probably said the gravity off the text view and the oldest text right on. Well, if I set the problem is that gravity is already said he right to center. And this gravity is referring. Toe the items to the elements that inside the text and these items these elements is for for now, for the Texas view on the text. So how to position this books up here? There's another attribute that this cult layout gravity, and now I can set it to the top, for example, and this guy I can set to the bottom. Okay, So layout gravity is gonna change the position off there. Element off the text view. Mm related toe the leaner lay out. Okay. Toe that you are the parent. Okay, so they are Gravity is gonna change the position related to the parent, but at gravity is changing the place or things that are insight. The element. OK, so that's the difference is very important to understand it. And of course, if I change these two, for example, wrapped content and here to wrap content, nothing will change because, well, right now, the layout gravity bottom means the same as stop. It means all the same thing all the time because the size off the layout gravity that it is referring to, So that that is related to sort of the leaner layout is just the same as the size of the text view that are inside. Right? So these just is not affecting mm, anything because it's not possible. But if you change it here to 300 dippy, yes, then it's gonna change the Tabor. This is gonna change it bottom or contributed center. It's all up to us. We're gonna do OK, so that's the difference between layoff, gravity and gravity, you know, know that you can, you know, group more than one leaner layout. Um, inside another leaner lay out because you need to just remember that. And the layout is just used for grouping. Okay? And every layout has with rules on these rules have to be respected by elements that are inside these layouts. Okay, that's only good lesson. Thank you very much.
76. layout_weight - dividing your layout proportionally: Hello, my friend. Today I'm going to tell me about their attribute. That is called layout weight. As the name suggests, it's gonna allow you to set importance the way the value in terms of how much space should be reserved by the element added to the layout. So what does it mean when we have good, for example, free lemons like Texaco's view skier And I call of them so we can see them clearly where, How much space they take. And when I said the layout way to one, it means it's gonna take available space remaining available space. Okay, so it just took everything but the space that was taken by this text. You and this text. Okay, But ive you do something like that when I, for example, at another layout weight and said it to also one and, for example, I at another one here and study to one. As you can see, all these free guys are what equal in the with right? Why in the week? Because we have good, the orientation set, toe horizontal, and the layout weight is gonna, you know, work on the week. Okay. If I said it vertical it's gonna work on the height. Okay? That's how it works. And as you can see, they are where they are equal now. Right? But why are they equal? Because we said the importance off each element to one to consider is one. Here's one. Here's one. If we set the importance of vigil aumento the same value, it's gonna they are gonna be equal, right? But, you know, you can say, Hey, I want this guy to be more important and these ones toe be not so important. Right? And as you can see now, this takes you inside its three times bigger than these one. Well, maybe it's not true because we should set the value of with 20 dp when we are using now known armies to when we're using the layout. Wait. Okay, because wrapped content is gonna take into consideration the details to wrap the counter and Bob are back. But when you studied 20 DP, it's now it's just gonna consider only lie outward. As you can see now, we could put like, free blue blocks here, right? And so So So this being one is three times bigger than these one So how to count it to calculate this? If you want to calculated, for example, So you can just like that one plus free is for four. Plus one is five. Right? So and this is gonna take 1/5 off the available space is gonna take free 0.5. Available space is gonna take 1 1/5 off the available space. Okay. Eso That's how the layout weight is working. And because of that approach. So you can, for example, well, change the rap content here too, for example, much Baron, right? So it's gonna take all the available space in there in the vertical way on that you can see now it looks like that and we can remove the partying that does that. It's here because we don't need it. And now, as you can see, we just divide it. This pace in our application can change, for example, android TV, and it's gonna look that same as you can see, right? You can change it toe on a smartphone, and it's always gonna take the same, you know, space. It's gonna take the same proportion 1/5 free fifth and 1/5. So it's really very, very useful to create their layout of replication. You can, you know, if your manual of content or and you can description whatever or you can have only two got to things like that right here is Manu. And here you have got some content, so it's very useful to use the leaner layout with the layout. Wait. OK, like that, Andi. Well, it's also probably good to know that if we change the text size here to, for example, first E S P. It's gonna you know, it's working pretty fine by the only working fine, because oh, I was talking about the desiccant. See, it doesn't align properly, so you have to use the based on Aligned to False. Okay, now with the line properly. Okay, Now it's like that. Okay, It's no good. And, well, you know, I'm using here Texas, but you could use here, you know, leaner layout. I used the text view just because, you know, I wanted to show you some texts. That simple text that you get, you know, we can say, Hey, we're talking about sample were taken sample to a simple free, so we can refer to things seem right. So you can use here instead of the text view, some kind off view group. So any layout gonna keep here? You see, for example, native a target. You can use a leaner layout you can use. For example. I agree day at whatever. That's all up to you. Right? And you can group inside off the big boxes. Now, some content for your up. Okay? The feeling that lesson. Thank you.