Hello, in this Java video, we are going to take a look at variables. So we're all variable variables are a way of storing data. Honestly, in, you know, at the core, there's nothing more to it than that. There are different data types that you have to specify for your variable. I'm going to cover that in a separate video, so feel free to check that out. But we're just going to cover you know how to create a variable.
So creating a variable is actually pretty simple. So we'll deal with the integer variable in this video entirely, because we'll cover the different types that you can have as well. So to do an integer variable, you put a keyword into space. Now you name your variable, so I'm going to name it we'll name it age, age, and you can percent Cola, that's fine as well. And you can assign a value to it. You can do a equals 26.
So I am 26 of creating this video. So let's go over what this is doing. So this is saying, create a variable called age. And its data type is an integer, which means it can only contain integers, which are whole numbers. It can be negative numbers, but whole numbers only. So let's analyze what you know line 83 minus eight is saying the sign what's on the right of the equals to what's on the left.
So assign 26 to age equals, in this context is assignment. In sometimes in other context, it can be sort of comparison. comparison is slightly different. We'll cover that later on in this series. So this is monix. And you'll just be because it's, you know, not used, you know, we haven't actually used it, we've assigned it but we haven't used anywhere.
Again, don't worry about that last clip. And some of the ideas that can sort of, you know, hover around like a, you know, a helicopter parent and just constantly asking you, are you gonna do this? Are you gonna do that? Why have you done this or like that. So let's use the print on the video go system dot out. And before we just put in a string, which is fine, but we can actually specify a variable as well.
So if we run this now, it prints out 26. That's pretty cool. So there's a nother way that you can create a variable loss like you do on a wedding day to talk to children. And let's say I will put for this machine I'll call this color. trying to think of, you know, decent turkey call this variable, I'll call it call it Hello. Doesn't really matter.
And instead of printing semi colon, what you can do is for equals and then assign the value there. So this just declares the variable, and this initializes it, this declares and initializing the variable. This doesn't mean that you can't assign another value to Hello name. So you could, you know, I demonstrate that do down below. So if I were to put here, it's done the print ln and I put in Hello, and I've run it, it will print out nine. If afterwards I was put Hello equals negative six.
And I run it, it still night and that's because the print line of the Hello variable came before the change. So it goes in a linear fashion code, Java and pretty much all Now if we run it out, did you have value and you can reassign or update a value for age, or, and any other variable pretty much. So that's it for I'll say the basics of variables. We're going to cover data types, which is essentially, you know, extending on top of variables. We'll cover modifier types as well. And we'll cover a few other really, really cool things to do with variables.
So thanks for watching. If you have any questions, feel free to reach out and I look forward to seeing you in the next video.