Introduction To JAVA Coding For Beginners | Michael Tsehlo | Skillshare

Playback Speed


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

Introduction To JAVA Coding For Beginners

teacher avatar Michael Tsehlo, Entrepreneur & Programmer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction

      1:08

    • 2.

      First Opening Up IntelliJ IDEA

      16:09

    • 3.

      Understanding The Use Of Quotation Marks When Printing

      1:35

    • 4.

      Comments

      6:48

    • 5.

      Variables

      18:32

    • 6.

      Print Variables

      8:51

    • 7.

      Declaring Multiple Variables

      4:24

    • 8.

      Identifiers

      4:35

    • 9.

      Data Types

      7:25

    • 10.

      Numbers

      6:37

    • 11.

      Booleans

      3:17

    • 12.

      Characters

      1:18

    • 13.

      Type Casting

      4:04

    • 14.

      Narrowing Casting

      3:26

    • 15.

      Definition Of Operators

      5:55

    • 16.

      Operator Groups

      2:43

    • 17.

      Assignment Operators

      4:12

    • 18.

      Comparison Operators

      4:18

    • 19.

      Java Strings

      9:14

    • 20.

      Concatenation

      3:43

    • 21.

      Java Math

      5:08

    • 22.

      Java Booleans Part 2

      5:55

    • 23.

      Conditional Statements

      8:31

    • 24.

      Class Project

      0:48

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

423

Students

1

Projects

About This Class

Introduction To JAVA Coding For Beginners

Coding can be intimidating but it doesn't have to be! Join Michael in this course as He breaks down  the fundamentals of Java Coding.

Michael has spent years experimenting on the best coding techniques when it comes to programming. You’ll learn tips and tricks he uses in his coding that you can incorporate into your workflow to make you a more intentional programmer.

In this class, you'll learn:

  • How to be an intentional Java Programmer
  • How to navigate, use and master IntelliJ IDEA CE
  • How To Create Different Data Types
  • How To Have Your PC Compute Complex Calculations For You In Seconds

This course was designed for:

  • Beginners from those with little to no experience at in Java Programming.
  • Anyone who wants to improve their general knowledge of Programming really. 

Hope to see you in the course dashboard!

Meet Your Teacher

Teacher Profile Image

Michael Tsehlo

Entrepreneur & Programmer

Teacher

Hey guys! I'm Michael.

Founder Of Voie Digital-Tech Start Up Based In Lesotho, I've scaled my Company To 7 Figures in the Last 2 Years Through Networking, Innovation & recently Coaching.

Most of what I teach relates to my background with photography, cinematography, Coding & Business Strategies, nevertheless I am ever expanding my focus as I continue to grow as a creative. Let's grow together!

If you'd like to find out more, please do my Skillshare profile, and if you're a fan of my content and you've got ideas for classes that you'd find useful, drop me a message/email and I'll see what I can do.

I'm super active on Instagram as well as facebook.

See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: Hi guys and welcome to my course. My name is Michael. I'm a photographer, cinematographer, and a physicist. And in this cost today I'll be sharing with you guys some tips and tricks that you can definitely use to up your coding skills. Being a physicist, I have the privilege of working with a number of languages from Python and Java and other languages. But in this course I'll be helping you guys to know your basics and work are onto your basics. Regarding Java, java is one of the most powerful languages that you can use or implement. And I hope that at the end of this course you'll be able to understand it better and know how to better use it, and just navigate your way around it. This course is primarily intended for beginners. So anybody who's probably has no idea what it had been led Java is, and how it works and all of that, that such an individual would be the ideal candidate to view this course. So I look forward to seeing you in the next lesson. Shares. 2. First Opening Up IntelliJ IDEA: So Java is one of the most essential programming languages out there. With Java, you know, you are able to use it from creating abs to create in desktop applications, to creating games, to creating so much even websites and all of that is just so many things, whether it's machine learning data science or any of that, you definitely need to Java for any of that. And this goes to multiple folds, including engineering, right? So the possibilities of Java programming are endless. It's just one of those languages that you definitely, definitely need. And what we're going to do first of all, is that we're just going to launch it. I'll show you guys as the sub tutorial that I use to program with Java. And we're going to go right into it right now. Yeah. So the first thing that we wanna do is so the first thing that we definitely wanna do is we want to make sure that we just launched our software. Usually I use IntelliJ G, IDA. See, Let's just click on that and then we'll just be launching it just like that. That is community to neutral need to, you can just download this off the Internet, just such IntelliJ g EDA. And when you search that, make sure that you also make sure that you also just make sure that it's the turn 21 version or 2022 version in my case. And this should be the interface that you get the moment that it launches. It will say welcome to until a, G, E, D, E. And what you want to do is you want to come over to New Project over here. And just click on that new project. In the moment that you click on New Project, this is where you get to simply name what the name of your project is and what language you will be using. Now, given that in our scenario will be working with Java, just make sure that it's on Java with that. And we can call this basics, for example, let me do that. Basic basics. And this is the location where this project will be saved. And this is just the Java Development Kit, which is G, D car is you can see in French we say God, but in English we just say k. And what we can do is just make sure that you just create that come over here and you don't even need necessarily anything here with the advanced settings. There's no need for that for now. And you can just come over here and click Create. And voila, this is what you have. And this is gonna be our overall setup of Java. It's still loading, as you can see, it's scanning files to index, meaning that it's still opening up our interface and all of that. That is so wonderful, that is really, really cool. Still loading and bear in mind that this is very demanding on PCs personally, I would recommend that you know, your PCs operating it at least eight gigabyte of RAM, at least. Double column minimum, that is an i5 or if possible ISO run. But you definitely need some of those things because this is quite heavy on a number of PCs. And once you're over here, it should keep on doing this. And voila should be okay now, okay. Then the next thing that you wanna do is you want to just click on, double-click over here or right-click if you want, and then select New. Come over to Java class. And this is where you give the name of the cluster Joe working with. Now you probably might be wondering what classes and all these things are for now, just think of it literally as a room where you get to do some activities inside of it. It's just a room. You can think of it literally like in high school when you went to a classroom. So think of it as like a room where activities happen. That's how you can think of a cluster for now. And then, as time goes on, as we learned the Java syntax or love Java language, we're able to better know what we're talking about. So let me just call that big six as well. Basics and Enter. And voila, here is our first view of it. As you can see, it literally says public class basics, basics. That's because I literally called the class itself basic, the project itself, its name is basics. And the class itself, I just called it Basics. And this is the overall interface that you should have. The definite thing that you want to start off. First of all, that the definitely thing that we definitely do want to start off is with the syntax, the Java syntax of Java syntax. Essentially what it is is, it's all about the Java language. It's about understanding the whole. Um, thing that's going on over here, the whole language that we're going to be using over here. It's so important and so crucial. And how do we do that? Well, we do that by understanding what kind of words that we'll be using. Bain mind that every line of code that runs in Java must be inside a class. As you can see here, we have public class basics. And in our, if I were to give you an example like the following, for example, I could probably write something like this. I'll just press Enter here and then give an example like this. Public static, void, main, main with a small letter. Normally, main types train, for example, string. And here I'll just select this guy here. Let me just do this. Yeah, change my keyboard to this one usually. And then I press Option G, S, Varela, beautiful. And I come over here and I press again, I come back to the original keyboard doors using and Carla, Yeah. So essentially everything that we want to write in here has got to be in a class, right? So as you can see, I just wrote this weird looking statement called public static void main. And I know you're probably wondering what is public static void main, but why not? I'm going to explain all of these things. But just bear in mind that when I have that, I can even literally just come over here and type something like this. This is Aztlan in the syntax, the model I'm writing some understands the model, just seeing what's possible and what's possible and what's not possible. And I'll choose print LN, and I click on Hello World. This is probably one of the most famous writings. Whenever we have programming language going on, we like saying hello world. There's nothing special about helloworld, It's just word, but we love using sought to explain what's going on over here because I know that you're probably wondering what is happening here. Well, what's important is this, the name of the Java file. Here, this must match the class name. So the name of the Java file, for example, here, the name is basics. It must match this public class. If I were to change this and put it as basic, literally just one S missing. Notice there's a problem, shows up here, problems here. This class basic as public, should be declared in a file name basic. You see that what essentially that means is that desk names are not corresponding. So that's one thing that you should be very careful of and be very cautious off when it comes to coding. Make sure that in Java, the name of the file, the name of the class file, Basics, has got to always make sure that it's in sync with the class as well. Alright, so that's going to be basics as well. So it's going to be basics, basics like that, right? So that's the first thing that's very important right? Now, if I were to just click on this and run this and we get an output of this by clicking this. Run basics main. Let's see what we get. And voila, we get the word helloworld, which is literally what we just typed in here, right? And just to even break down what's going on here much better, let me start off with the word main over here. What main is, is that main is a method, write. The main method is required and you will see it in every Java program. It's going to be something that we'll be seeing a lot of times any code inside the main method will be executed, right? So this is a main method and any code that's in here is going to be executed. You see that? And I am saying inside of it, because I've put this to symbols over here. There's two set braces if you want. And they are representing what is inside of a cold, right? What is inside of the code now, because I'm on a Mac, for me, literally, my keyboard isn't that big, so I have to press Option and press F5 in order to get access this, but you can always check for you wet your keyboard allows you to use among the French version right now. So if I'm using this one, then as you can see, if I press option over here, then the set braces come in that I need. You see that? Alternatively, there's also this one here. If I change the keyboard as well, I can access more options. So it's just a metal. Preference and you know, and at different keywords gives you access to different symbols. And don't worry about the keywords before and after mean. You'll get to know them of course, in a bit as we're going through some of these things together. But for now, it's very important that you remember every Java program has a class and a class name which must match the filename, and that every program must contain the main method, every program. Then we get into this line over here, line number three here, the listings of the lines representing our code. When we get into line three over here, we have system out print LN, hello world. Right now. Definitely Hello World is definitely did a text that we're seeing over there. So I'll get into that a bit shortly. But for now, what we have got to know is this. Inside the main method, we can use the print LN method to print a line of text to the screen. So you can think of print. Whenever you had a print, it's literally saying output, right? It's literally saying output. It's a combination of all these three wordings over here. System, essentially System is a built-in Java class that contains useful members such as out, which is short for output, right? So when you see out, in essence it's actually saying the output. And then when I say print, I'm saying that output should be written down. It should be written now, when you see print out n, It's a short form for print line. So what's the difference between just an ordinary print imagined Our to delete this part over here and just leave it as print like this. What would be the difference between print like this and print in this following format? Well, at this stage, it might not be too evident. Alright, might look like it's still the same thing. We're still getting the same result. But then wait a minute, let me copy this literally statement. And I press Enter paste of the weather and change it a bit HelloWorld. And let's say hello Michael. And now you're going to see something happen here. Hello Michael and I press Run program. And viola, look at that bit strange, right? Hello World, right back. Hello Michael. But imagine I were to do this LN so that you're going to see that difference right here. Ah, look at that. So what does this mean? It means that the moment that you say print LN, in essence, we are saying print whatever that I have here in its own individual line and print whatever I have next, if I'd have it like this has printed means printed as within one line, right? But if I were to add another print, it would be stacked with this hello Michael as well, unless I've put l n. So by putting them in essence saying that it should just be one line, whatever print that I have over there should just be this statement and then pass on to the next line. It's literally almost a safe. What I'm doing here with my keyboard, which is pressing Enter, literally when you say print LN, It's almost as if you're literally doing that. Pressing Enter, pressing Enter. So whatever is written and read it. And then I go down and I read it and then I go down and then I read it and then I go down. That's literally what's going on over here. But then print LN, you're simply saying that all outputs, whatever output that I have should be written next to the next to the next to the next to the next to an exponent next to the next atom, to the next item over there. You see that? So essentially what you want to do is it's up to you. I cannot really tell you to always use print LN. I can also not always tell you to be using print alone. You see that? So it depends on what are you trying to achieve, what are you trying to get to, right? We have learned what system is all about with lend about. That system is a class that contains useful members such as out, which is the output and print that it's literally saying, whatever I have should be put down here, written down if you want. Then we also have this semicolon over here. And you should know that each code in Java must end with a semicolon. So that's very, very important. Without it motorists and didn't get an error if I remove that Vanna. This is literally the Java programs telling you something here missing. Got to fix that. And you can see this with an error here, one error. And I can always come over to programs problems here or there. And it's showing that the problem is this, this is expected, but it's ln four and it's been showing you the line where this is the problem. It's expected, but it's not being farmed. So I put the semicolon and voila, everything is okay. Gain, right? So I hope that, I hope that you guys are seeing acoustic bit awesome differences and a bit of some context to what's going on over here, right? Especially when it comes to this basic coding of this basic line and the syntax that we use in Java. 3. Understanding The Use Of Quotation Marks When Printing: So the program is able to understand what is going on here and just do accordingly. So that's, that's incredible. That's perfect, that's amazing, right? So the next thing that we definitely want to look into mind probably be using and understanding as well. That here when we're using numbers, bear in mind that we didn't put double quotations like that, right? Because that would mean something else very, very different. If I were to put this, this quotations here, I would actually be calling this to be a string. And I would literally say that print whatever that is in there literally, it wouldn't understand them as statements or as numbers, you would what I get them as statements or sentences or words. You see that? So I don't want that. I don't want that. That's if I wanted to compute nine plus ten for me, right? Nine plus ten for me, and it gives me 19. Bain Man, I could have even just said nine multiplied by ten, which would give me 90, right? Let's see, 90 day it is. So annual operation, addition, subtraction, division multiplication should work. It should definitely work for you. So feel free to even play around yourself on your own software intelligence, of course, and see how you are able to produce some of these things together, right? Yeah, yeah. So that's that's essentially what it is. And that's about it. 4. Comments: Alright, and then the next thing that we're going to look into has got to do with Java comments. And Java comments bear in mind that this is something that we use a lot, especially with Java because there's so much code sometimes if you're working on and you just want to comment a bit on what's going on over there. You want to tell a bit of a story just so that you are able to not get lost in your own code because there's so much, If there's so much code over there and you're not even able to tell which is weird, what is going on here. It's so confusing, right? So you always want to make sure that you have some comments going on as well. And we're going to talk about single line comment and comments that are multiple line comments as well, right? And we're where we deal with single line comment is like this. We can just come over to our code. For example, let's say that in this scenario here, I wanted to make a single line comment. I would just press Shift, and there it is, I create this. Whatever I write here will be a comment. For example, let me write this. This is a comment. A comment is just a piece of statement that you want to write as a way of reminding yourself what's going on over here. Let's say you are making an app, or you were making a game or your weekend. There's a lot of cool that's involved in that. But it's so easy for you to get lost into wondering what that is. For example, imagine you had something of the following kind of the following kind. So much information, right? Of course this is just an example, but it helps for you to know that this is common one. For example, this is comment one for example. You could come over to this second place and say, Okay, now here I'm talking about this is how to drive my car. Let's say you were maybe making a game, an app that runs a game, right? This is how you'd put all the code that has got to do with driving of the car. And let's say here, this is where I choose the color. So this is where you'd know that, okay, any code does involve here has got to do with the choosing of color and so on and so forth. I hope you get into hole drift over here. The whole idea really is that this commenting technique allows you to be more precise with your information and know exactly what you're doing when you're doing that. You see that it helps you sort out that if you close this file and open it later, you wouldn't even get lost. You're always remember that? Yeah. Yeah. Actually, I know that when it comes to me coding and looking for a way to choose the colors, I just need to come to this point over there. You see that? So that's it about single line commenting. And we say single line because we said single line because it's just one line. If I were to write something here, just below this, let me do this. I press Enter. It does not register as a common how do I know it does not register as a comment? Well, I can just look at it over here. Look at this one that's a comment over here. Even the color linked looks to be faded. It looks great, but then this color is more alive. That means that the software is trying to understand us, to try and to understand what type of code is this, What's going on over here, you see that? So that's why there's an error over all of it and there is no error over the common line over there. You see that? So essentially that's the difference between single line commenting that we're talking about here. But then when it comes to, when it comes to multiple line commenting, this is whereby you want to comment and your comments. I've got to be long. Let's say it was a full paragraph, right? So let's say that this is why color, I choose the color and then I were to say enter off my vehicle. Alright, now let's say a one to this also to be part of the comment, What do I do? Well, I just come over here, I cancel this line. I put a star there and I come here and I've put a star here, and I put a, put this beautiful symbol over here as well. You see that slash over there. And it's almost as if I'm ascend wishing this comment that has multiple lines. It takes two lines as you can see, and it could take, given ten lines, it doesn't matter. As long, as long as it's more than one line, it qualifies for it to be multiple line comment as a sandwich it with the slash star and then star n slash. It's almost as if you're opening it and then you are closing it and anything that's between those two openings, the first one being this one will slash star. And star slash is understood as a comment, right? Even if there were lines being skipped, for example, let's say I were to remove that. And notice that all of this so far, all of this has just lost its common needs, right? So as you can see, the effect that I have a slash and a star over here or an asterix piston. Once you pull this, java will not fully understand what's going on over here. That's why everything here has been rendered colorless. If colorless, because what Java is saying is all of that is a comment. It's like I've opened a comment and I have not yet closed it. So everything that's in here will be rendered as a comment. If I can, if I want, I could put an asterix or a star slash here and then it would understand that, okay, the rest of this is code, then it's not really a comment. So I can remove this and then as you can see, it will register again, the same thing. Alright. So here's an asterix here and I move it. And everything is a comment again until I put a star slash there and limiting it and seeing all of this is indeed a comment and it ends here. Or if I want, I could put it here to wish I'd say only this is what I'm playing with. Only this is where the code should be. You should be looking for objects or methods or any of the things that I need for my code. But the rest is a common. Do you see that? This one is called a multi-line coding or multiline commenting. You see that? So essentially that's the difference between single line comments and multi-line comments. 5. Variables: Now the next thing that we want to talk about as Java variables. There are multiple variables in Java, from strings to Booleans, two integers, two doubles, two floors to chars there so many, right? And with each of these ones, I'm just going to demonstrate over here and we're going to explore each of those variables and see how they come into play in what we're doing, right? So let me just put this as a single line comment and say this are strings, right? So let me just put this and remove this by commenting that and star velar. So it means I'm trying to get rid of all all the errors here. So let's do this and I'm going to put this slash star and law. Was this the first one or was it not the first one? Here is wrong. Let me make this a comment. In essence, rendering this to be errorless. As you can see, there's no error at all. Since there is no error, that's because all of this has just made into your comment. Now, let's look into and explore what strings are. Strings are, essentially what we're dealing with at the very start of this. What we're dealing with at the very start of our lesson on this. So I could make a stream by just genuinely coming over here saying string right there where string is. And let me put a comment on this as well. Comment and var. Great. So let me put this again, public class basics and public. Public, static, static, public, static, void, main. And I can just copy this and paste it right here. Copy and pasted right here. Open the set braces and voila, we're ready. And then I say system out, That's for output, dot, print, LN. And I choose into a string. How do I identify what a string is? A string as anything that's put inside of this two braces over there. That's what we call a string. What is trimmed does is that essentially it stalls texts such as Hello. And strings are always surrounded by double quotes. So that's so important to understand that. That's essentially how we identify a string. And string could be something like right here. If you love French, you could say boundary. Let me just put this here. And time. Von drew, for example, if you love French, it's like hello. And then I put a semicolon and let me see where the error is. I think there's one arrow here and wondering what it is. All right, This, this, this two guys are not in the brackets. Okay, great. So I can run this and bond your data stream. So that's the thing about a string. It's just stored information. That's what it is. And then you are I'm printing that stored piece of information. That day. It is, it's a string. So that's, that's essentially it about strings that we might want to know. That's essentially it about strings that we might want to know. The next thing that we want to talk about. That's probably, and that's it of our strings. And then the next thing that we need to know and take note when declaring a variable. Well, when declaring a variable, you must specify the type and assign it a value, right? So what type of variable is it? Is it a string? Is it an int desires that are flawed as it is shy? Is it a Boolean? What type is it? And you must also state the variable name. It must follow the following order. It must be of the order of type. Firstly, that's how we do it. And then variable name, the variable name, type, variable name, and also their value. That's how you do it. You see that? So it must follow this format whenever you create any variable. So if I were to make a string, for example, my string would probably go something like this. I'll say string. And then I say name. And then I say is equivalent to let me put it as a comment because that's what Mount what I'm trying to Say, and then I say John here for example. And then I close the bracket and then I put it with a semicolon over there. So I could literally just take this statement and put it in a main method because that's where everything hangs. Everything is properly making sense when it's in a, in a class, right? So bear in mind that this was not in cluster, that's why it was given us an error. So once it's in here, everything is okay. It's proper code. And if I want to print this guy here, here I've declared the type of variable. It is, the name. The name of the variable. This variable represents people's names. That's it. And this is the exact name and it's a string. How do we know? Because there are double-quotes over there. So if I want to write it down, I could say a system dot out, dot, print, LN, and in brackets, I said name. There it is, and semicolon. So let's see what we get now and we run that and we get John bond you. So that's amazing. That's really, really cool. And if you wanted it to be one line, remember that you can always play around if your print and just be more flexible around that you could literally console just this line over there and have it like This. Jon Bon Jovi right? Now, you probably might say to me, But what about that space? I don't like the fact that John and bonjour are merged together. That's very simple. You can always just press space, ad, space in-between adult quotation. And then in-between that quotation, let there be nothing in-between. It's more likely to add some space in between that and the moment you do that, then it's just gonna be John bone Ju, You see that? So that's incredible. That's amazing. That's how we declare or even create. If you want, create a variable, it must follow the following order. It should be a type, then the name, and then the value of whatever it is that you're trying to talk about, right? Then when we are talking about numbers, when we're dealing with numbers, Bain minded numbers could be. Let me write it this way. You numbers could be, could be when I'm saying numbers, I could be referring to integers. I could be talking about integers, I could be talking about doubles. I'll get into double soon. Doubles. I could be talking about flows. I could be talking about the so many ways in which I could definitely go about what numbers I am interested in, in, in, in, in, in exploring or looking into, right? Could be integers or floats or Yeah, so many, so many options are doubles if you want. But for now we'll just focus especially on integers and floats. Doubles will explore them further later on. With this as well. How do we do we go about the same method? We're just going to look into the type. So if it's a type, if I'm trying to get into an integer, the type is got to be the type of an integer. So for me to do that, I'll just create a line, press Enter, make sure that it's always in alignment over there. E and T, That's how we present or declare, or we say it's declared, but essentially it's in English, it's simply just creating, were creating it type of an integer. And then we can name it my number, my number, and then I press Space and as a equals to 26, That's what my number is, of course, to end semicolon, you see that? If I want to print it, what do I do? I can just go below it and say system. System dot out, dot print LN, and print my end. As you can see, Java is already suggesting that for mu over here. So I can just click over there. Or if I want, I can press Enter and it's already understood, it's already understood it. I put semicolon and I run the program, and normally it should be working. Normally. Data's 26 is below that. That's because of the LN that was here. It's put it below. You see that? So that's, that's really, really cool. That's a very helpful thing just to have and understand, right? So that's how we declare an integer. So I can just put it in a comment here just to remind myself what's going on. This is an integer and this is, I put a line there and so this is a string variable, integer variable. There they are. So that's really, really cool. Yeah, The next thing that we want to look into is this one that we call a float. Now, declaring a float an integer, as you know, it's just a whole number. An integer as you know, it's just a whole number. What that means, it's numbers like 0123456 and so on and so forth. And this store odd numbers. This can be positive or negative, right? But then a float is different if fluid is more like a real number in English, what that means is that it must have decimals. You see that must always have decimals. But in an intense, I cannot have any decimals because it's just a whole number, you see that? But a float has decimals. That's essentially the difference between the two and the way that we declare. And the way that we declare a float would be we declare again type float, float. Let me call it real number. Let's name of this type. It's real number is equals to 20. Let's call it 3.1482. In fact, let me call it Pi so that that would be more relevant for you. Pay, that's what pays all about. Pi is like that. Then I say semicolon. Now, the moment that you look at this, what would you say is the issue with this number? This number looks okay, but then it looks like there's a problem. That's the thing right there. If my float does not have an F attached to it at the end, it will always register is a problem. Because the Python must undergo, the Javan must understand this and understand that this is a fluid that we're talking about. If I leave it like this, I'm essentially saying that it's in double. Double is a number that will look into much later, like I said, but f clearly makes it, makes the Java understand that this is a real number that I'm looking at over here, right? So if you run this, let's run it. John Bernard 26 now ways my number of ways my floating number. Well, it's not there because you didn't declare it, you didn't tell it to come out and be seen. So if you want it to come out and be same user system, dot out, dot print, and you click Pi. So datas and semicolon. Now it will show, now it will show today it is 3.1482 datas. You see that? So that's a really, really cool thing just to definitely know about. And then the next thing that you definitely want to look into and know about would be what we call not only the sign numbers anymore, but this is called a sharp. Sharp and a Boolean, Boole Leon, a shark and a Boolean. Now what is Shad does is, and what a Boolean does is this, well, it's sharp. It's just a means of storing single characters such as a or B. And they're always surrounded by single quotes. So you can always see them by something like this. That's how their spot, That's what a shy is. It's a shorter version of a string, right? But then a boolean is always seen with statements are true or false. So you can declare something and then check, is it true that it's this way or is it false that it's this way, right? So an example of this can always be something like this. For example. Something like this, for example, it could be like Schar. My laptop, for example, is equals to. And then I put a single quote over there, and T, for example, and voila, I have stored that whenever I type or print my letter gives me one single character. That character could have been anything, but I store letters with it. So that's why it will short t When I call it. And then boolean for it will just be this way. So I call it, I call it test for example. And then is equals to two, is equals to true, the semicolon over there. And voila. So I could print any of this things by just doing system as always, system dot out, dot, print LN and I can print a test. And it will say true. And if I print, I copy this and paste it here. And I say, print my letter, Vedas and Enter. And there's my letter over there. And I print them and they're going to show there it is 3.1428. And the reason why it's attached to this, again, that's because on our pi here we didn't put LN. So if I put LN, as you'll notice, it will go in its respective lines. So there it is, 3.142 to the n t right? Now, of course, as you are doing actual coding with them, it could be as basic as this, but decided definitely tools that you definitely need to understand when you are working with variables. This is very important, very crucial. Now, let's say that you were working around with, for example, this pie over here, which is a number that's fixed. Pie doesn't change at all. It always remains the same. It's always 3.1482, goes on and on and on and so forth. And for such a fixed number that doesn't change, maybe you might want to consider even putting the word final before them. Essentially, when you put final before such a term, what you are saying is that you don't want it to be over overwritten, right? Overwritten. What that means is next time when you declare something like float and call it Pi again and change the number from 3.14223.15. For example. Java will refuse. Jamal refused and said No, that's not possible, that's not possible. But if there was no final if there was no final like this, then it wasn't gonna be a problem. 6. Print Variables: The next thing that I want to talk about is called Java print variables. And this is where we are just working around the whole printing of variables and how that is done in different scenarios and how to maximize that, right? So let me just write it down for us here. Let me call it. Let me highlight all of this that we've just written. Just this line because that's all that I need. And then the rest of what I have here, I'm just going to put a comment on it and say slash star. So the rest, the whole thing is under comment slash star. So it means everything is a common errors and I need this, this one I definitely need. And there's something here missing. What could it be? Well, it's the fact that these things are opened but didn't seem to have anything that's closing them. You see that swayed means I need to have some of those things that will close them. So here they are. And here they are. Here they, since it's one open, one, open one, open one, open one shows one clause. So that's why there's no error over there and everything's perfect. So when it comes to printing variables, the print LN method is often used to display variables. To combine both texts and a variable, we use the plus character, which is something that I used over here, as you can notice, for example, in this string name that I called John, I could say hello. For example here I could say hello. So let me just put that in and say hello. So I put that as a string over there. And I say hello plus, and then I put space. Then I say plus name, right? So in essence, what will I see? I wish I should see hello plus a bit of some space between hello and my name. What is my name? My name is John. That's how Java will interpret that. So let me run it and then we see what essentially comes from that. Hello John. There it is, You see that? And the reason why we have that space over there, remember, it's because of this. Had we not had the space and notice what would have happened. Notice what happened. This is irrespective of the amount of space that you have between this plus here and name, even if you were to put it this far. Notice what the Java wall still understand by that. Hello John, You see that? So you need to state it. It's not about the level of speeds between that. It's about, you're declaring to Java that I need space in between that, space in-between that. So here it is. And viola, Hello John, You see that? So if I were to increase the space that's in-between here, then indeed, yes, that would cause a difference. That would cause a difference. You see that? Bad. That's why logically there's one line, this one, literally just one space over here that we need. We don't need too much space. This might just be enough for us. Just bear in mind that you can always use this addition sign or character to the variable, to another variable. Imagine I had two strings. What if I was like, I was making like an app and then I said this is my first name is John and then my surname as a string says, surname. I say is equivalent to say John Doe, for example, NSA semicolon then, and it's red because it's not finding anything that's called name because I changed it to firstName. So there it is. Firstname. And I don't need the Halo anymore. Well, I might still need Hello. Good to Great. Alright. Say a plus, NASA's surname. Surname and Enter. And if I print this nominee, what I should see, Hello, John Doe, See that. So I go and datas. Hello John Doe. Now why is there no space between John Doe? That again, because there is no space here. So I could just literally copy this up until here and put it right. They say If I put it right here, what happens is it essentially just creates this Hello John Doe. So that's it. That's an example of us taking and adding two variables right here, the variables firstName and send them. Those are the two variables that we're talking about over there. And there's this. Hello here that we've just declared in the print method as well. For numeric values, the positive or the addition character works as a numerical mathematical operator. You see that if I were to declare, for example, something like something like int x equals to three or two. And y is equals to five. And I were to say system. If I were to say system out, dot out dot, print LN an hour to say x plus y, x plus y. That is. So here, the positive sign will not end as it will not act as something that is like a gluing them together. It would act more like a mathematical operator between the two. So it's gonna be two plus five, which would be seven. So data is John Doe seven. That's because here I didn't use n. So if I put LN, then it should show us clearly that this is x plus x plus y is equals to Seven. Right? Now, maybe you might want to say to me, But what if I wanted to, to actually write for me not just the answer, but write that X plus Y is equals to seven. Well, the way that you'd have to do that would be probably you just taking x itself plus y itself and put in them like a string with an equal sign over there. And here. Yeah. With an addition sign over here in-between them. And day It is x plus y is equals to. Now. Now it says What? Now it says x plus y is equals to 25. Why is it equals to 25? Well, it's equals to 25. C. 7. Declaring Multiple Variables: So declaring multiple variables. Now you might probably be wondering why would we need to declare multiple variables? Well, a good example is what you see right above here. Well, imagine I had integer x is equals to two, and integer y is the cost of five. And I were to say integer z is equals to seven. Integer z is equals to seven as a semicolon. Bit of work, it's like for each thing I need to put on a separate line, so that might be a bit tiring. An alternative to this would be me doing this instead. What if I were to say integer in the next, say, x is equals to two, then right there. I say y is equals to five, right there. And say z is equals to seven, alright? And semicolon right? Now, you're probably wondering why it's putting this red arrows here literally on our variables. That's because we're declaring them clients, which is not allowed, right? So we're just going to put a slash and a star and comment on them as if we have never even used them before. And voila, right? And we'll take this line and put it below them here so that it's able to understand that this is the things that we've already declared. We don't ask it to do something without giving you the thing that we needed to do, right? We give it we tell it to do it after it has already received them, right? So right now we have just declared or created a variable x. And inside this docket of x, It's like we have placed the value two inside this bracket of why we've placed the value five inside this bucket of Z, we've placed the value of seven. If we were to do this x plus y plus z, then it was going to just going to calculate this for us. It's going to be two plus 57 plus 714. There we go. 14, See that? So that's, that's the effectiveness over there. For multi variable declaration. There could be a scenario where you have one, put this as a comment. One value to multiple variables that you could have and maybe you want to talk about that. You could literally do that by saying integer x, y. Let me change the variables here so that I don't have to comment into the a, B, C. Then you say a is equals to b, is equals to c, is equals to seven. So it means what have I done at one goal? What I've done is I've declared that a is equals to b is equals to c is equals to seven. All of them share one value. All of them have, each of them have the value seven. That's essentially what's going on over here. And if I were to say system, dot out, dot print, print, LN, what would I get? I should get seven. If I say a plus b plus c, I should get seven, right? And I've put this line here and semicolon, I should get seven plus seven plus seven, which should be 21. So let's see 21 day this, that's because it's 77 here. Plus seven, plus seven day. So that's gonna be 21 right there. So yeah, that's the beauty of one value to multiple variables. 8. Identifiers: Now the next thing that we want to talk about is called Java identify as being minded, we use identifiers in order for us people who according to better understand exactly what exactly we are talking about. Can you imagine if I was talking about a code, for example, making a particular game and so many cars in this game, there's so many variables that the way that each game should be, each car, for example, should behave right? So we use some names here, and when we use are declared names of some of these things here. We have to remember that the names have got to be very, very specific weight. If I were to talk about cars like Ferrari's. Right, let me go for because I feel like I'm not too familiar. February lumbar guineas for example, in limbo. Yeah, I'm just set lambda Islam again is yeah. And with lumbar guineas for example, what I would want to do is if I call it, name it gelato for example, that's a gelato. Gelato with a big G. And let's say this was a string, and I call it gelato. A string with a gun ladder name is not going to be a string with it's not going to be the same as a string with this small G Gelato name like that, right? So it's so important to note that each of their letters that are represented in your name play a big role. This big G changes everything. This is different from this. And that's how if in general understanding of AI plays inside of this gelato here, I say 500 horsepower, for example, it has 500 HP, and in this one, There's 300 HP. Alright? Bear in mind that as you will notice shortly, when I print this, it's gonna give me something else that's very difference or system dot out, dot, print LN. And I say gelato dough. And I put this here. Well, you might be wondering, why is it that it's doing this? That's because it's not inside the main method over there. It must be in a method. So I'm going to cut this and paste it inside of this Math lot here and voila, there it is. And then take this as well, cut it and put it here as we still remember what we're doing here. And there it is. 300 HP. That's for a gullible. They see that as because I called for this gelato. But if I change and change this Gn go into the big G, I'm calling for the other gelato, 500 HP ways of getting yet. That's because it's from this one way, is just to tell you that names are so specific, the ought to be very specific. Preferably you don't want to put a space in between a name. As you can notice that it gives you an error. Even if I were to do this, it's not that's not a problem. The problem is that my name that identifies the name of my variable should not have a space in-between, right? Otherwise you can use, you can use as many things that you want to use over there. You can put letters, digits, underscores, and dollar signs. But names must begin with a letter, right? So you will, your name cannot start with just all with a number like that. No. It can have a number in-between. No problem. No problem. But it cannot start with a letter. You see? It cannot start with a letter. It can not start with a number, rather, not a letter. Excuse that. Also names that are like int or Boolean cannot be used as names. These are names that are already reserved. The psyche worth of Java. You know, the names of the types of strings that we're talking about, the types of variables that we're talking about like AND Boolean and many more. You see that? So that's also very important to understand and bear in mind. 9. Data Types: Alright, so the next thing that we definitely want to look into his gut to do with datatypes. So datatypes, Bain mind that data types. So quite a number of them. We have, for example, the bite. What makes a byte interesting is that it can store whole numbers from, I believe, from negative 128 all the way to a 127. So that's a byte for you. And then alternatively what we have is we have a short which can and despite should be with small letter with a short which can store whole numbers from negative 32,768 to 32,767. That's a shot for you. And then we also have an integer which can store values from negative 2 billion, I believe, to be neon, 147,483,648. That's from that to a similar similar amount. This other side as well should be quite a large number, indeed, quiet. Large number e, indeed, almost a replica of the other, really just different from it by one. That's an integer for you. And we also have our long, long. It can keep numbers from quite a large number. Quite a large number indeed. It is over the 223372036856. All the way to let's see. This is definitely not all food, 547750 aid. That's an extremely humungous number. Extremely large number. Essentially it's going to be the same thing really, except the last term should be different, I believe. Sorry, I put this here and then on the very last term over there, I'm just going to put a seven. And that's along. And then there's a float, which is gonna be from just false fractional numbers and it stalls especially between from six to seven decimal places. Yeah. Then a double, which we've been talking about for awhile, stores fractional numbers up to 15 decimal decimal places. So that's what a double does for you. And then we also have a Boolean. Boolean, and Booleans or stars, true or false. True or false. A Boolean true or false values for you. Lastly, we have our Shaw. Shaw, which just stores a single character, one character. So just, just as a recap that here on the float we have fractional numbers again. So there it is. There, we have there we have it. So not only is this important, but also know that depending on whether you choose, know that not only is that important, but just bear in mind that whether you choose to use it by the short and the long offload a double a Boolean, a shock. It will contribute as well on the size, right? So the sizes are as follows. For a byte, we have a size of, I believe this is one byte. That's the size over there. So that's one byte. Then as phi as, let me put this below it, truly just below it here. Then as far as the shot is concerned, we use up the space of about two bytes or two bytes. As far as the int is concerned as well. We use up the space of about four bytes. As far as their long as concerned, we use up space. Bear in mind that the space is getting larger because of large deserts that are involved. Over here. You can see that this is going to be eight bytes or eight bytes, and that's a long over there. And then flowed would take up four bytes. And then a double would take up eight bytes as well. Because it has quite a large number of values going on over there. And then with a Boolean will just only take up one bit. And then a sharp would take up two bytes as well. Yeah, just two bytes, right? Sharp, like a shot would take up two bytes and long like a double would take up eight bytes. And that's it about about datatypes. 10. Numbers: So the next thing that we want to talk about in more detail is what is called Javan numbers, right? So let me just put that as a comment and then I say Javan numbers. Java numbers are essentially. Now the next thing that we definitely do want to talk about is called Javan numbers, right? And Java numbers essentially when we talk about them, as you can see on the screen, we have in Java numbers over there. This are essentially write primitive numbers are all datatypes I essentially divided into two groups. We have integer, integer type, all the, let me put it right here. Integer type, all the floating type. Alright, it's a floating type, integer type. Whenever we talk about integer type, what we're essentially talking about is more like a shot and end along. Such information you see that this is essentially a short and end and a long, right? But then the moment that I started talking about floating, floating. This is just a comment. So that's going to be floating. I am referring to float. Float, definitely and double. You see that? So it's just important just for you to know what is it that you're talking about and the kind of writing that's involved with such things. For example, if you are talking about is short, for example, a shot can just store, as you know that it's short, can store numbers between theta2, negative 32,768, all the way to this, 32,700 and something it means you can, even numbers like 5 thousand can definitely fit in this category, right? So if I were to write down, for example, is short, I could declare shot. If I go all the way up here and we put it in here, I could literally write something like this and go shot. Let me put a comment and say integer. Number. Stroke would say a shot. Now obviously I had, I would have to give my shot in name. So let's say my number. Number one is equals two. It could be 8 thousand, for example. It could be 8 thousand. Let me just put it here for us. It could be 8 thousand semicolon. There is no error rate. But if I were to make it 80 thousand error, Why is that? Because the limit is between negative thirty two thousand and thirty two thousand, right? So I have to make it 8 thousand. No problem. I could even go all the way to 32 thousand itself. No problem. But then 33 thousand era, you see that? So 32 thousand is okay. That's a shortfall in me that I can use and I can just use it however way you want. Obviously, it's going to take a bit of some species, as we noticed in the things that we're doing just literally here, that it takes about two bytes of space that it's going to take. And that's a shot. And then I have an end that I can use which have been using all this time. So I'll call it myInt one and say is equals to n. As you know that an Incan contain over 2 billion. So I could literally put up a number as crazy as this. And I'll still be okay, as crazy as this, because this should be about 2 billion. I think all the keys train t, which is this, this is this is printing million, so I'm still within range. That's no problem. No problem at all. An end could be of this nature and along could be of this mile-long, could be of this nature, and this is humungous and lumber. There was about nine extremely large number. Extremely large number. Yeah. Probably trillion I think. But then my huge, huge number, which I could put 8123456789. I think. Let me see. Yeah. I think it's okay. Probably it's probably bigger than the number that it should be. So I'll put it at eight, like this. I think that's the way of my long would end. And they are all declared properly, no problems. But then with the floating numbers as well, there's a bit more of some technicality here that we have to be cautious. Or for example, if I use a float and then semi float and I'd say is equals to my flows across to say, 5.7689. There it is. That should that should work, but why is it not working? That's because there is no f. So I'll put F, it understands. Okay, so that's a float. Then alternatively, I could put up a double, which is a larger version. And my door, and I say it's equals to 8.995, false. I can put as many terms in there, one just less than 15, of course. And I do this again. Normally in some contexts you find that doubles don't function like this unless you put a D next to them, right? So I usually like preparing and putting a D just next to them that way to make sure that everything is perfectly crystal work. Even like this, it could still work as you can see, but putting d is just more technically correct. So that's that's what I love at the end of the day. That's what I love at the end of the day, Bain mind that I could just print any of this things by just putting a System.out.print my num one on mine, int1, on my long my inflow or do any of them, I could put them just below and then I'll be able to get the correct answer. 11. Booleans : Now we go into the Java boolean data types. And this is where we mentioned that we are focusing especially on the true or false responses. So for that as well, we're just gonna go in here and let me just tap that for us so that we know we're talking about Java. Boolean. Boolean data types. Does here, tax rate. And here, the key thing really that we need to understand and bear in mind is that, oh, my keywords here with our boolean can only be the values that can only be taken are true or false. So an example of this would be, let's go all the way back into our main method so that I can put this in for us. And I say Bool, Boolean, yeah, and he's the type, the type of what we're talking about is a boolean for sure. But then what is the name? We could ask a question, could say, is, is coding fun? Then we insert true, for example. Alright, so we could just genuinely create something on this type over here, as good as coding fun, for example. And we type in true. And then maybe it's fashion Cool. Is fashion cool? And then we say false, for example. Some people would argue in that. And then we put a semicolon over there. And then we just have to print that out for ourselves. And so system dot out, dot print LN. Then we say is, let's get it, is quoting a fun enter. And then we put a semicolon. And then we can tie up again the system dot out, dot, print LN. And then we say is fashion Cool? Is fashion Cool. Let's see, we did it with a small letter. So data's is fresh and cool. Semicolon as well. And when we print that, let me put everything else in as a comment. As a comment. As a common solid, we only see this is everything else is a comment. Everything else will be a comment. There it is. And you go and voila, that is true, is coding fun day is a true. Especially in cool, false, right? And that is where the data's, you have it, that is new habits. So that's really, really cool. 12. Characters: Then the next thing that we want to look into is got to do with Java characters. Now note that you must be wondering what this is all about, but Java characters has got to do with that part that I kept on saying is the sharp, right? And that has got to do with this shot, right? And we can use this especially maybe if you are, you can think of it more like somebody's students in high school and we're just trying to give the grades, we could type in shock and then say my grade is, let's say you're brilliant and let's say that is going to be, we put this in a single letter, a, a, right? And then he says semicolon. And then we can print this out and say system out, print, print LN, and there is print what, migrate, Enter semicolon. Again, I need to just put this out as a common does well, just sort out. We keep going. And day It is a my grade is an a, right? So this comes in very handy. Of course, if somebody's like a student and you want to make sure that the information is highlighted out like that for us. 13. Type Casting: Alright guys, so the next thing that we're definitely talking about is called Java type casting. And the best way to explain casting to use you can think of casting is molecule conversion, right? And we have two types of casting that is widening casting, which essentially is just an automatic way of converting a small type of the variable that is a larger type. And we're talking about small or large in terms of sizes over here. Hence why we move from a byte. This is widened casting. It's like us converting from a bias to a shot to shot when integer to wear long to a float or a double, right? As you can see, all those we have increasing sizes, as you remember the datatypes here, we spoke about them and increasing sizes over there. And then narrowing casting is the exact opposite of that because with narrowing customer, what we're doing is exactly that in reverse in the sense that in narrowing casting, we are manually converting a larger type to a smaller size type. That's why we start with the largest one, a double, then offload than alone, than an integer, Danny Shaw than a shot, then a bite. Finally, see that the best way to do this would be, let's start off first with an example. I'll make an example of widening casting. So we'll name it like that. And let's go right into it. We come to our main method over here, as you can see. And an example of this would be, let's say that we had an integer and call it my mind, my int one for example. And let's give it an assign it a value of tall, for example. And we close that, come down and then make a double. As you know that the size of an int compared to a double, it's an increase in size in, into smaller than a double. So we're going up and we're taking that same value that we had, an end, which is 12, when now making it a double. How do we do that? We name our double. Let's go with my ado. One. Do for double. If you want, I could just put it as double. And then here I assign the exact integer that we had. And if I type system, dot out, dot print, let me just put that here. The print. And what do I print? I can print both of them. So let me print my double firstly and then secondly, let me copy that and paste it below. And just change what is in my parenthesis over here. And put my right. Essentially what's going on is this. We have our small size, type size of an end as we know the sizes we saw them here, that they increasing sizes. As you can see, an end is definitely smaller than a double. But then we're taking that same in that smaller and then one now making it bigger. You see that? So that's a widening casting. You see that you could think of it more like we're increasing its size. And you might probably be wondering why would we want to increase the size of that? Well, as you continue with programming, there are situations that definitely require you to wet Audi or things like that. So let's just run this and see what we get. Should have a double which is a larger number first, again, here it is 12.012, right? Ben minded. With it just being in the sense it will give us, this is essentially what we're seeing here, is essentially what an automatic, it's an automatic word. It's an automatic casting. An int. Then tradable. Java does that for us automatically, right? 14. Narrowing Casting: The opposite of this is now row in casting, narrow and casting. And an example of this would be the same example but in reverse. So firstly, let's define our double. And let's call it My do too. Let's equate it to, let's even decide just how long it's going to be. Let's say it's going to be 14. How much should be 97, for example. And then we assign a D that it ends there continuously going on like that. Then what do we do next is we define an int and we call it my end too. And we say it's equals to mind due to. Now, this should be very interesting. This should be very, very interesting. Look at that. The moment I do this, it gives me an error. In the previous case, it didn't. Why? Because Java was able to automatically converted for me. I was able to understand that, hey, this is an integer and if now be changed, tweet type of a double. You see that, but in this case, it's not doing that, right? So that's the thing when you're moving from larger type sizes to smallest type size, you've got to define exactly what you're doing. So what I'm gonna do is here, we're gonna put in parenthesis int close, and everything's okay now, everything is okay. Essentially, that's the manual casting that we've just done over there at the manual aspect of it, It's not automatic in the sense that Java can not just do that for us here. Here you've got to define it that I am converting you into an insulated and understand. Then after this has happened, it's now stored in this. Think of it like a box called My into, right? So let's just go ahead and print that system dot out print. Let's print my two there, this and paste this end here as well. We save into, Alright, cool. So we should have about four values show up here. We can always just put this ones, of course, this too in. We can put them in comments or soda. We don't. They shouldn't interfere with our results are Bouvier in common, so they are neglected essentially. And let's run this and see what we get. Right. So why did we get it like this? That's because we didn't put print LN. So you need to put an n here. You could put it down there as well, definitely, but it's already there, I think. So just print and that is 14.96, which is this our double. And for int, we converted that same value into what? Into n, into jar. You see that? So it took the integers and we have 14. So that's about it guys. That's really good about the whole idea of Java casting. There are many other things of cost to explore here, but for now, this is definitely, it. 15. Definition Of Operators: Alright, so the next thing that we wanna talk about, wonderful people is what we call Java. Let me put this as a comment again. This is called Java operators. What are Java operators as well? You can think of it more like mathematical operators. Operators are essentially what we use to perform operations on variables and values. For example, in this scenario here where I have, for example, the following, let me just write it for us. Let me remove this guy here and put him here. Now, let's just think of the scenario here where I'm using. And let me put that in comments or per radius. So you can think of it like this. So right here, we're going to use the operator plus. So we'll start with an operator plus the minimum operators I'll add. So for now we'll just leave it as plus. And I'll say int plus and say it's equivalent to, let me just write it down and then we'll take it out, try to understand it properly. After Effects index because that's the name of our integer. It's equivalent to 45 plus 60. Close. Let's understand, let's run it first and see if it runs and then we elaborate what's going on over there. Our y is in Detroit because we didn't print it out. We didn't tell the system to print it out. So there it is. And from time to time I'll be doing some of these things if you can pick them up. That's really good. Shows progress. That scene. X over there. Yeah. So let's see, the value of X should be a hundred and five, hundred and five days. So that's exactly Beautiful. What we have done here is we've named obviously this variable, the int type. We've named it and then we just 45 plus 60, meaning that add these two values, I could have even changed it to multiply. Let me put that comma lens and multiply as well with an asterix over there, which is going to multiply for the five by 60, which should be 2700. Could have done that with divide for example. But just bear in mind that this is not gonna give me, since this is a whole number, this might not be the very smartest thing for you to do, because there's gonna be a fraction, I believe it should be three over four under normal circumstances, but since I've put it as a whole number, it's genuinely just going to give me 0 because it's essentially 0.75. You see, I'd have to change its definition here. Maybe give it a float. Double if I want. I usually love using doubles. 45, Let's see. Should register as 0.75. Data's here for a minute there it was trying to play around with me, right? Yes. It should be 45 over 60, which is three over five, which is three over four, which is 0.75. So that's, that's pretty much it over there, right? And like I said, there are many more things that you can use. Obviously, like I said, division definitely works. There's also subtraction if you want. I mean, where there's addition, there's got to be subtraction. So we could do that with subtraction and just save 45 minus six t. And that's gonna give us negative 15. So that, that really is the beauty of just working with operations. It's really doing those mathematical, mathematically complex things in a very simplified manner, right? When the older the positive impurities operator is often used to add together two values, like in the example that we're using just before. It can also be used to add together a variable and a value IN variable and another variable. And to better understand that, you can think of it like this. For example. Think of it like int y is equals to x plus ten y naught. Let me call it double wide because I already called it a double here. So let's call it a double y, x plus ten. Why not? Why not initially with this gives us what negative 15 plus ten. How much does it give us? And let's run it. That's a number n variable. When we run that. And we definitely have put a y there because that's the value that we're seeking for not x. So that's going to give us negative five. That's because you have negative 15 plus ten. So that's the thing right there. Wonderful people. You can just even get the joy of adding even variables. With variables, you see that you can literally just say declaring new variable and then call it w. Z is equals to y plus x, y naught. It can work. Y plus c, It can work. Why will it not work? Should be negative five. You see that? If we name it there, we're going to find Z. The exact value I think, should be negative ten, if I remember well, or negative 20 equals negative 15 and negative five exactly a negative 20. So that's, that's the beauty of it. That's the beauty of essentially working with this. 16. Operator Groups: And, you know, Java essentially operates device the operators into several groups. The R groups like and I'll put this in comments for us. Name them java groups. Java groups of operators. And here they are. We have, for example, arithmetic one's, arithmetic ones. We have, for example, the assignment 1's and we have comparisons. These are all different groups of operators. We have logical groups or logical operators if you want. And last but not least, we have bitwise groups as well. You see that soft costs with, depending on the level of depth that you are working with, you will come across such things. Definitely such things. But the last thing that you might want to definitely take note off and keep in your arsenal of coding is also just knowing this kind of operators. You see that the different signs that we're using, I already showed you like addition and subtraction. There is division, there is multiplication, which we'll represent by an asterix. But then there's way more than this. You see that for example, we could use like the modulus sign, modulus lines given by the percentage. And what that does is that it simply returns the division remainder. You see that? It returns the division remainder. So you divide, for example, five by two, you get two. It's actually true, and then it leaves out one, right? So if you use a modulus, some five modulus two will just give you one because the remainder would be one. You see that? So essentially that's how it functions. And then we also have an increment which we represent by this, which essentially means that you increase the value of a variable by one, increase the value of variable by one. So that's a really cool thing. And negative, negative does the exact opposite of this just to decrease the value of a variable by one. Essentially that's what it's all about. 17. Assignment Operators: Then when we talk about Java assignment operators, assignment operators are used to assign values to variables. In, for example, in this example that I'm about to show you over here, you can think of them like this. Let me just put the force here that you're able to see what is going on. So let me just say assignment. Assignment. This are our assignment operators. And a good example of this would just be, for example, if you just say and y is equals to 29, you've just done what? You have assigned the value 29 into why or how by using the operator is equals true. So that's how it works, right? That's what it works. By putting its equals two, you are assigning something into something. You're not saying something is equals to something or saying something is assigned into something else. You see that? Then of course the additional assignment could function, for example, like this where we just simply say y plus is equals to. In fact, let me just say Z plus is equals to y. And let me just clean this up for us and then they put it up properly. This is an assignment, one that we do. So you can think of it more like a, like this. Let me just put it like this and say y plus z equals to three, for example, right? So essentially what I'm saying here is that in essence it's more like this. It's more like I'm saying, y is equals to Y plus three. See that? So essentially if I have my y, it will be 29 plus three, which will be 32. I can just assign it as plus is equals to three. So it's more like on my y, assign. And add a three on my y as sine and add F3. See that? So let me just make sure that everything else is in cleared up because we don't need any of that. And let's come here and try and run this and see what we get from this. So it should be a system, dot out, dot print LN. And we say, what is y, What is y? Let's see what we get when we run. Our code. Should be 32, voila, there it is, 32 right there. See that? So that's the additional assignment. Of course you could have done that as well with the negative sign. And with many, many other operators, you could use a positive sign. For addition, all negative on subtraction, multiplication you could do in modulus. You could do it with many, many symbols in deed, it's just a matter of you deciding ultimately how you want to do that. You see that. Just to give you an example. There is, for example, you could have done like, for example, if you were to say y is equals to, let's say y minus is equals to five for example. You see that, and then you close that. There could also be Y percentage to Y percentage is equals to two. For example. There could also be why. The possibilities as genuinely. 18. Comparison Operators: The possibilities are just genuinely endless rate. And just bear in mind that if you did however, want to do some Java comparison operators, that is compare, that is comparison operators. So those ones, let me just put a comment here so that it's very clear that one lot trying to code something that we're just putting a text for own node wilderness Bain mind that you could use this double sign to represent that something is definitely something is definitely equals to something else. So this means something is equals to something else. And then if you put an exclamation point, exclamation point like this with an equals, it means that something is different, different from. Let me just put that down for you so that you don't even have to confuse it with anything else. So it means different to or not equals to. This one means definitely equal to. And there are so many, for example, there's something that's greater than, um, and then there's something that's lesser than. And then there's also this one where we say less or equals two, right? So that's essentially less than or equals to. So it is less than or equals to, right? And the opposite would just be greater than or equals to, greater than or equals to. Then we also have Java. We also have java logical operators. Logical operators which function in the following manner. If you were to have two ampersands, for example, to Emperor sense like this, what does that mean? It would mean that its logical end. And what that means, by the way, is it returns true if both statements are true. Example of this, because it's not very clear for, for, for, for, to the naked eye, you'd think of x is less than six, for example. And then you'd say ampersand, ampersand. And then you'd say x is also less than nine, for example. Let me put that as x is less than nine, for example, right? So that means it's got to fulfill both. Both, both conditions. X should definitely be less than n be listed nine. Or we could have done the opposite here and Xij should be less than and greater than. Though it's got to have some logic rate. So it has to be greater than three, for example, meaning x is contained between 63, but six, N3 themselves are not included. 63 themselves are not included. How do we know that? Because there's no equal sign on any of them. On ME, of them, we say c. And there are many more java logical operators of course, but or about a few. There is also the one that has got to do just an exclamation point, which means that it's not logical AND logical NOD, as they call it, which simply reverses the result returns false. If the result is true, you see that? So just bear in mind to all this possibilities that exist right here. 19. Java Strings: Then the next thing that we want to definitely look into has got to do with what we call Java strings. This is probably the most one that you'll be coming across a lot of times that is Java strings. So let me put that down for us. Java strings. And what Java strings essentially is all about. It's, it's how we explain the concept of strings. We sent that strings are just used for storing text. It's a string essentially it's just a variable containing a collection of characters surrounded by double quotes. That's how we identify a string. If it has double-quotes and we know that it's a string, right? So an example of that would be string of favorite thing that we love when coding string greeting. And then we say is equivalent to hello everybody. Hello everybody. Alright. So essentially that's going to be like that. But what is missing? Notation, max, these two quotes that we need right there. So they've got to be there. By all means. Voila, there it is, looks green. No error is perfect that what it is. And it's string in Java is actually an object which contains methods that can perform certain operations on strings. For example, the length of a string can be found with the length method. Now, what is the length method? Think of it like alphabets, right? Think of it like alphabets. Thing. For example. This greeting. If I wanted to count how many letters, how many characters if you want, are there in this. How would I do that? And I want to just make sure that I remove this like this and bringing clothes like that, that would make perfect sense even more. Bring hello everybody together. How would I do that? I'll just say system, dot out, dot print LN. And I'll just say, for example, the length of a greeting is put double notation max and say add there, what am I adding? Plus greeting, greeting, dot length. And just close that. And just like that, I'll be able to find out just how long our text is, or how long or how many characters were in the word. Hello everybody. Just like that. And the length of a greeting is 14. So let's try and count that fossils and see here is each one, 234567891011121314. So data's to the dot 14 characters, so the number of letters that are there. And with most coding courses, you find that what the examiner might do or whoever is teaching you would do is they'll probably write something like string and then type, for example, TXT text, that is. And then put letters of an alphabet, a, B, C, D E, F, G H I J K L M N O P Q R S T as T V W X Y, Z. Then put like an end over there and simply just put over here instead of the length of a greeting that finding the length of this text. Just like that. They run it and they find the number to be 25. That's because I left one of them. Let's see. Anomalies should be 26 alphabets, a, B, C, D E, F, G H I J K L M N O P Q R S T U V W X Y, Z. Yeah, yeah. Forgive me if I forget, if I forgot one of the alphabets over there. But essentially, yeah, you definitely see how it's able to count this 25 letters for us, right? So that's cool. That's amazing. And there's definitely way more string methods than that, right? For example, we have two uppercase and then to lowercase, for example, on our looking at our text over here with this alphabet that I have here that might not be the most perfect ones. I could, for example, rewrite the whole thing in lower caps, as you can see, all of the mine upper capsule. But what if I wanted to put all of them in low caps? How do I do that? Well, it's simple. How do we do that? Well, you just do this, can cancel out all of that. And writing instead of, we're not finding the length, we're not interested in it and length, rather we're interested in to lowercase. So there it is. To lowercase viola. And with us click on Run, run it, and we're going to see it all again, just in lowercase. That is, everything has been made into lowercase. The same thing applies over here. Instead of just that greeting being the way it is. We could do this to it. We could just have it all go in uppercase to lowercase, to uppercase. And let's move this, giving us an error there. Run it and voila status. This is our texts, but let's do the greeting. Greeting to uppercase should be Hello. Everybody, see that? So there it is with large letters, right? And there's also the possibility maybe let's say you wanted to find a character in a string, right? So we use what we call the index method, right? Because it returns the index that is the position of the first occurrence of a specified texts in a string, including a whitespace. Whitespace. So for example, what if I wanted to find in the word hello everybody? What if I wanted to find the position? The position of everybody? So to do that, I could just let me copy that and paste it again because I already have that. I could just say simply greeting. Then I said dot index off. There it is, index off. And it's an index of what? Is it a string? Bass, the options, since I'm a indexing a value, characters, what am I indexing? So I'm definitely indexing a string. A string. So what's the name of that string? So the name of that string is, so for example, let's say I'm looking to just locate the position of one of these letters over here. For example, let's say I'm looking for the letter Z and I want to locate the position of the letter Z. So just come over here and click on Text and just move this to index off. And that is a string that I'm looking for. On that string, what am I going to look for? I'm just going to put quotation and put the letter z, right? And just run that and see what I come up with. See what I come up with. So there it is, position 24. Now you're probably wondering, but I had 25 letters. Why is it giving me 24? Well, when Java count, it starts from 0. So if you start from 0, you're literally taking every number that you would have counted normally, buy one. It's like you're subtracting by one. So that's why ultimately we have 24 instead of 0.5. You see that? If you want to be a bit fancy, you could literally, you could literally put and print in this something more like find a position of and then you are attached to that. The value that you want over they write the value that you want all day. 20. Concatenation: Alright, and then the next thing that we wanna talk about is called concatenation. And what is a concatenation? Let's have that written for us here. Catenation. Concatenation essentially is the best way to think of it. It's like this. In a case, for example, of a string concatenation. When you have, for example, addition operator, it can be used between strings to combine them. That combination that occurs there is what we call Kong car Tan Ni Shun, that is called concatenation over there. And concatenation, how will we do it? Essentially, what we're gonna do, for example, is we know we had a moment where we spoke just a bit about this, but here we able to do it much further. And, you know, you are able to, for example, let's just say it's something that we've been doing already. We just didn't know that we're still concatenating. So think of it like you have the opportunity to, for example, let's say you were to say we have a strain. It's a name. And then it's Chris example. And then you also have synthesis train. I should put double codes. So here I have another string, the surname. It's Chris Johnson for example. Yep. Screens Johnson. And I'm going to put that out. And ultimately what I can do is I can just simply do this name plus the fact that I'm using a plus and surname. This is where concatenation essentially comes in. I have concatenated those two variables over there. Alright? And what do I get? I get Chris Johnson. I could add a space over here between them just to ensure that this space in-between them, of course, and how large that space is. Of course, if they are how large it is in-between will determine how supported the arts or just one space bar should be enough. And dad is Chris Johnson. You see that? So there's two variable types. That is strings of costs have been concatenated. And you can also use the conquered method to concatenate two strings, right? So this one, how does it occur? Instead of me doing this that I've done here? I could have done this. I could say, let's do it right now together. I'll say name.com cut. That is last name or surname. Surname. There is. And I don't need this anymore. So this is an alternative to what we've just done before here. So it should give us the same results. Chris Johnson soda, it is Chris Johnson. Chris Johnson, even below as well. You see that? So that's the thing right there. The flexibility with this, the fact that you are able to end the spacebar much easier on the second scenario here that is not so easy to do just at first glance, of course progressively you are able to learn better. But for now, this is what we're able to do, right? 21. Java Math: And then the next thing that we want to talk about is Java math. And what Java math is essentially all about is this is more like a class that really allows you to perform a lot of mathematical tasks on numbers. So for example, the math, the math max method can be used to find the highest value of x and y, right? So for example, if you had, for example, something like math dot max and you wait to introduce maybe 719. So the best way to do this, of course, is if you have something of the following manner, you might want to just put it right here and it's a system. Dot out, dot print LN and just put that in a bracket. And its system like that, of course, close it up and Java should be able to detect this was telling us that 19 is the big one. Could do the alternate version of this and say mean, of course. And even here, Java should tell us that seven is the minimum one. So there it is, right? So that's a really, really cool thing that can happen over there. Under Java math. These are some operations that are already in the program. And then there's also SQRT, which literally means square root. So it allows you to get a square root of any number that you want. Even numbers that are fairly complex like 80, let's say square root of 80, which should be between 89. So there it is, 8.94 data like that, like that for you, well done already. And then you can also be, you can use the math ABS, which is used for absolute values. So ABS and ABS essentially will return the absolute positive value of x. This works well if you have a negative number like this, for example, the best way to do, let me change my keyboard. Best way to do is just put like negative 80. It should give you positive 80. There it is. That's because it's an absolute number. And absolute numbers are Paul's always right. And we can also have a math random, which returns a random number between 01, which is inclusive by the way. So let me just run that oneness for us and just say random here. Alright. So there it is. Let's run it. And it's going to return a number between 0.010 or just randomly. So if I run it again, likely I wouldn't get the same thing. See that? So to kill on randomizing and just randomly bring up random numbers popping up like that, right? To get more control over the random number, maybe you only want a random number between 0100. You can use the following formula. We can use a formula of the following type. And just say, for example, that hey, random int is equals to, you are gaining some control. Over here is some bit of some almost like casting, narrowing casting if you want, that were still doing here. And let me just put this here, voila, That's why I wanted math. This is Math dot random. And then right here uses C multiplied by a hundred and one hundred and one. Essentially what that means is from 0 to a 100. That's what, that's essentially what that means. And since this is a comment that just make sure that the common mode is activated, comment mold is activated. And all you have to do, therefore here is print. Print this value here. Sort ILS, print, random and t. So that is, we have three. Alright, let's run it again and see how much we get. Now. We have 17. Let's run it again and see how much we get. Now, we get seven. This is just random values. There's more fixed formula to how this is happening, just random villus coming out, 48 and so on. And you can do this as many times as you want, and it will keep on giving you different values, right? If ever it were to repeat a number, just know that there would be, a complete coincidence, wouldn't be because there's something necessarily special about the number. It's just random values running. 22. Java Booleans Part 2: Then the next thing that we definitely want to look into is called or rather has got to do with java booleans. While our java booleans, well, very often in programming, you will need a data type that can only have one of two values like yes or no, On, Off, True or false. This happens a lot in machine learning and the whole aspect of AI as well, right? And Java has a Boolean data type which can take values true or false. Boolean values. Or a Boolean type is declared with a Boolean keyword and can only take values of true or false. So for example, like we mentioned last time, we could talk about how Boolean and then we say is Java fun example. And we assigned to it, drew here, definitely is. And we could talk about how Boolean is. Is food good? That sounds like a rain. No, it's not. It's not. Coding is good, not food. Then you could say system dot out, dot, print LN. And then right in there, you can type what you had placed initially is jumbled fun, and you'd get whatever it is that you want to get there. And then in here as well, you could just put, is food good? And when you run those two, you should get True or false. True or false. That is true or false according to what was assigned to it, right? And granted, it is more common to return Boolean values from Boolean expressions for conditional testings, you see that conditional testings that comes in very handy. And this is something that we'll explore in more detail as we go on. But just for a Boolean expression, the Boolean expression is as Java expression that returns a Boolean value, true or false. You can use comparison operators such as the greater than operator to find out if an expression or a variable is true, right? So this can be very helpful. And I, for example, think of it more like, like this. Think of it more like this. Let's say you had int x is equals to eight. And let's say you had int y is equals to three. And you wanted to check, for example, just which one is greater between the two in terms of true or false, right? So make a statement, for example, and say system dot out, dot print LN and make a statement like x is greater than, why is that true or false? Now, you and I would look at X and Z is bigger than three and then would say, Yeah, definitely, That's true. That's true. So let's see. Java is able to detect that. And why I believe that's because our y or y is not being accepted here because I'm sure there's a point like here where we still had our y active. So let's put that on the comment so that we don't have to worry about that. Good. So here it's y is accessible again. So let's see. That is true down here. So data is true, and I could always put this n comments as well, just to ensure that we do not continuous, right? So let me run it again just for you to enjoy enjoy areas. It's going to be true. Again. I'm sure they stole our random number here after running. That's the one that gives us 95. So let me remove that one. We don't need that anymore. Essentially what we need is that, alright? And we could even do it like ways you could even do it in a more easier way whereby we can include the values themselves instead of just putting those values, we could put like 4567, is this, is, this, is this true or false? Let's see. It's false. That's Java automatically does that for you and is like, Hey, this is a Boolean and this is a true or false situation here. And if definitely false, but five is not bigger than 67. So essentially that is exactly what is going on over there. And they in mind that you could do this as well with the equals sign and just say for example, 45 is 45 equals two. And remember we show equals to by double equal signs equals 267. Let's see, when Java runs it. Let's see, pressed the Debug button over there. What I want to press Run false. It's not true. It's not true, but is 45, let's see. It's 45 equals to 45, True? True. See that? Yeah, that's because food five e is equivalent to 45. So that's the beauty of using Boolean expressions. Just a bit of that. As S comes to most situations, you are able to definitely see the value of that. 23. Conditional Statements: Then the next thing that we want to explore is probably one of the more meaty things that comes in, especially in the whole applications of coding. And that has got to do with conditional statements, right? This false. The first one is Java's if else conditional statement. Java's if else conditional statement. So that's because Java suppose the usual logical conditions from mathematics. While it's less than, greater than equals to equals two. Java has built in conditional statements within it. So you can use if, for example, can use if, if you want to specify a block of code to be executed, if the specified condition is true. You can use, if that, if something is true, then you can use else to specify a block of code to be executed if the condition is false, you see that? And then else if as well, this, this, this if else, days, else if, which is used to specify a new condition to test if the first condition is false. And then they switch as well. Switch, which switch? Conditional statement or switch case to specify many alternative blocks of code to be executed, our focus is going to be fundamentally on if and else, especially right? And perhaps on else-if. Alright? And this is the same with other coding languages. You can think of this like, more like in a practical example. The way that they would look, for example, let's say if, if you put them, if there are four, is greater than 15, for example, what should happen? So that's how, that's how it works over there. So I'll just open my parenthesis over here and just put it like that. And the moment that I do this, I'm trying to see where the error is here because I have not even done anything yet, but it's already giving me an error. Okay. Yeah. I think that's okay. Is it though? No. I don't think that's okay. I don't think that's okay. Let's see. Let me add another one. Yeah. It's okay. No, it's okay. That's where the error was. Because of a lot of comments that I've done in this whole code that I'm doing now. So I could say for example, system dot out, dot print and just type something like 20 or 34 is greater than 34 is greater than 15, Right? Yeah, That's if this condition is satisfied, if this condition is true, then this is what should happen, right? Then this is what should happen if that is true. So Java will understand and run this and check instead of all greater than 15, if it is, I'm going to write this. If it's not, it's not going to write anything else because I have not written it. I've not told it what to do. If it's not true, it will write it. Why? Because it is true. But let me do this and put the alternative situation here and set that of four. If four is less than 15, now, write the following. If I do this, it will not write anything there as far as that one is concerned, right? Nothing is there this truest or from the previous scenario. And to avoid, you probably wonder to install doing there. Let's put it in a quotation and run it and see nothing. Nothing. That's because we didn't specify what should happen if the condition is not satisfied as true, right? And this brings us to the second part of our thing here to then say. But then if this is not the case, then how will, what will happen in the opposite alternative situation? To fully understand that one too Well, let me just remove this and make sure that I get this. This is what I'm looking for. This guy up down here. Let me delete all of that. And voila, else. So there's my else statement over there. Else, what should be written if the above condition is not met? What should be written? Our type? And just tell it to write. Condition not satisfied. For example, condition not satisfied. Voila. There it is. Let's run it and see condition not satisfied. This is condition is not satisfied. Here. There it is. So the else statement accounts for a scenario whereby the condition that was pleased, what's false? If it's true, it will execute. If it's false, it will not execute. So that's the, that's where the issue comes in, right? And that's the beauty of it right there. That's definitely the beauty of it. And you can use the else if statement to specify a new condition. If the condition is false. The benefit of this one is just the idea that it allows you to specify as many conditions as possible. But the else only is used. A final verdict to say if something is false, this is what you find entity. That's all. But else, if like here, I couldn't literally replace this with else-if and it will still work. It was 210% work. But with else if here, you need to bear in mind that I can put another condition and say else. If, for example, when t is less than 16, then what should I write? You see that? So let's do that and see now why did it not read anything? That's because here, Java extensions as instead of dollars on 50 nodes, not less than 15, it said, Okay, let me skip. Maybe I'll find something that will satisfy it and then say else, if print is less than 16 tied, this insect that's a 20, is not less than 16. So it found it, oh my goodness, I can't write anything. I could still put else here and say else. Of course I want to put my else outside of this, so that is a OLS. And in my else now I could type something as simple as system. System, dot out, dot, print. And conditions are not satisfied. Let me put it as both conditions so that it's clear that we're talking about this last one. Ball both condition is not satisfied. It checked if and then it checks else-if and then it finally rested on else to say, okay, if both are not satisfied, and therefore, this is what happens. But what happens if we do the opposite here? Well, if we do this, it's searches and this is what we get. Essentially just stops on the very first line because it's like we're satisfied, we've already printed, we don't need to go on. That's how Java will understand what is going on here, right? 24. Class Project: Alright, thank you guys so much for joining this course. I hope that you have learned so much and that all that you've learned, you genuinely seeing its value and its implementation in everyday life. That's the thing about Java is that it has so many users. And as you probably noticed with some of the examples we're giving, that there's so many applications of this and I hope that you are able to apply them. And for your class project, what do I want you to do is I've attached some exercise over here. I would like to see how you guys are able to solve this problem that I've attached right here. And I would love to get some dot code. So if you have solved this exercise that I have attached to the project files, just send that answer through and I will give you feedback on that. Alright, cheers.