Java Basics for Beginners: Learn Coding with Java | Victor Gorinov | Skillshare

Java Basics for Beginners: Learn Coding with Java

Victor Gorinov, Automation QA and Programming Instructor

Java Basics for Beginners: Learn Coding with Java

Victor Gorinov, Automation QA and Programming Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
16 Lessons (1h 56m)
    • 1. Course Introduction

      1:03
    • 2. Install Java JDK

      9:56
    • 3. Install IntelliJ IDEA + Create Your First Java Application

      7:59
    • 4. Understand Basic Programming

      9:25
    • 5. Variables

      8:05
    • 6. Getting User Input

      4:34
    • 7. Building a Basic Calculator with Java

      7:19
    • 8. Building a Basic Greeting Program with Java

      5:01
    • 9. If else statements - Your First Code Logic

      6:43
    • 10. Switch Statements

      4:31
    • 11. For Loops

      7:08
    • 12. While and Do While Loops

      6:14
    • 13. Methods

      10:14
    • 14. Arrays

      15:11
    • 15. Classes and Access Modifiers

      12:21
    • 16. Thank You!

      0:25
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

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.

17

Students

--

Projects

About This Class

Start Learning Java from Scratch!

This Course is Being Updated Constantly!

Learn Java Fundamentals in 2 Hours, Not Months!

This course is for beginners or people who want to refresh their knowledge in programming with Java.

Some Statistics:

  • 97% of Enterprise Desktops run Java

  • Java is the number 1 choice for software developers

  • 3 billion mobile phones run Java

  • 89% of Desktops in the U.S. run Java

  • 125 million TV devices run Java

Why would you choose to learn Java?

There are a lot of programming languages to choose from.
The main reason why you should pick Java is popularity. According to many researches Java is easily in the top 3 programming languages in the world, if not #1. This means that companies are looking for Java developers, which are much less than the open positions. Java opens a career opportunity in a very profitable sector, such as IT. Java s a language is growing for the last 30 years, which means it's been established and it's not something that will become unpopular any time soon.

Java is a popular choice for employers for a good reasons. You can use Java for many different purposes, such as:

  • Building Web Applications

  • Game Development

  • Mobile Development (Android mobile applications)

  • Desktop Applications

  • Windows client applications

  • Windows services

  • Backend services

  • Blockchains and  Cryptocurrency

  • Internet of Things (IoT) devices and much more

In the beginning of your Java learning experience, programming will be hard and that's why you should not try to learn everything at once.
In this course you will learn basic coding skills with Java and all the information you need to transfer to the IT field.
As a complete beginner you need to focus on the Fundamentals and build a solid foundation of your basic programming skills.
In this Java course you will get the best step-by-step training with real life coding examples and exercises.

You don't need anything to start with the course. We will start from absolute zero.
First - We will Install Java JDK.
After that - We will Install IntelliJ IDEA - this is the environment where we write our code.
Next - You will understand the
basics of programming (same for every programming language).
After that I will teach you Fundamentals that you need to start with:

  • Variables

  • Methods/Functions

  • Classes

  • Conditional Statements

  • Loops

  • Inheritance (Basic OOP Principle)

  • Debugging your code and more

If You Are Someone Who:

  • Want to Learn Programming with Java

  • Want to have Better Career Options

  • Want to make More Money at Your Job or as a Freelancer

  • Want to achieve Financial Freedom and Enjoy Life

Get started with this course - today!

You will also get:
- Support and Answers to All Your Questions During the Course


I'll see you in the first lesson!

Meet Your Teacher

Teacher Profile Image

Victor Gorinov

Automation QA and Programming Instructor

Teacher

Hello!
My name is Victor Gorinov and I am a Software Automation Engineer and Online Instructor.


On Skillshare I'm teaching IT Courses - mainly focused on Programming for beginners and Quality Assurance both Manual and Automation.


My passion is teaching other people on topics I'm knowledgeable about and seeing their results.
I have always been fascinated by the endless possibilities that we have in our time and the opportunity to reach millions of people with a single click of your mouse.

I am currently working as QA Consultant and in my free time I'm teaching people through digital channels. I am also involved in freelancing, affiliate marketing, investing in the stock market, selling private label products on Amazon and more.

I'm pass... See full profile

Class Ratings

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

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

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.

phone

Transcripts

1. Course Introduction: Hello and welcome to the Java basics course. My name is Victor and I'll be your teacher for the course. For the past few years, I have been working in the IT industry. And in this course you will learn the basics and fundamentals of Java. In the fundamentals of programming in general, we will go very basic and step-by-step into learning the fundamentals of Java, you will learn how to write if else statements, switch statements, loops, arrays, classes, and much more. This course is for anyone who wants to learn the basics of programming and more specifically Java. And if you're wondering, keep programming is something for you, but you're not sure this course is for you. You'll learn the fundamentals in. You'll be able to decide that this is something that you like and to one Chase and to pursue a career in the IT industry as a developer. Thank you for watching. And if you're interested in the course, let's start now. 2. Install Java JDK: Hello guys. In this video I'm going to show you how you can download and install Java JDK on your computer. So without wasting any time, the first thing that we want to do is to check if you already have it. So here down in the search bar, type CMD or start typing comment prompt. And open the command prompt and type this command java space hyphen version. If you don't have Java installed on your computer, you'll see this message here. Java is not recognized as an internal or external command. That basically means that you don't have Java JDK installed. And one more thing that we want to do here is type Java C, which is the command that we use to, to compile our java files. Java C space hyphen version. And you will see the same message here, which means that you don't have Java JDK installed. Okay, so what we want to do now is to go to your browser. I'm using Chrome and I'm going to type Java JDK. And the first page that I see is by Oracle.com. I want to click here. I will also paste this link in the description of the video. Now on this page we see that the latest version of Java is E 14 No.1. If we scroll down, we'll see that the java is 11 is the long-term support version. Down below we see also this version, Java asi eight, you 2-5-1. But what we want to install is the latest version, which is Java AC 14 dot 0, not one. So I'm going to click here on JDK download. And on this page you want to scroll down a little bit. And to find the windows x 64 installer. Ent, we want the exit executable files. So the dot EXE, not the zip file, but we want the executable file. So find the Windows 64 installer and click on the dot EXE file. Check this thing right here where I say that I reviewed and accepted the oracle, basically terms and conditions and download the JDK. Okay, this will take a few seconds to download, okay, now the JDK is downloaded. I'm going to click on it. Now the installation will begin. I'm clicking next. This will be the default folder where the Java JDK will be installed. I suggest that you keep the default folder. Don't change it if you don't hear funny reason to do so. After that click Next. Now it's being installed. And finally we get this message that the Java development kit was successfully installed. If I click close now, I will go to the location where I installed the JDK, which was C Program Files, Java. And I have the JDK folder here with the version that I have installed. By the time I'm making this video, the latest version is 1401. But for You probably it will be an, a newer version. So when I open this JDK folder, I see this bin folder inside of it. And this will be the important folder for you. In the bin folder you have folder Java files. The next step now is to sit this bin folder us, our environment variable, so we can run all the Java commands from the command prompt. So click here on the top to take the path to the bin folder. Copy this. So what we want to do now is to click on the Windows button. After that click on settings. The next thing is to click on System and start typing environment. And click on the edit, the system environment variables. You will see the screen sit in properties and now click on environment variables. This is where you add your environment variables. For Java. Now what we want to do is to add our environment variable. So I'm going to find here path. You need to find this path environment variable and click Edit. And we want to add here on this row the, the path to the bin folder. So I'm going to paste it here. The path to the bin folder. So C Program Files, Java JDK 14.140 No.1 slash bin. And I'm going to click OK. Now this environment variable is set. The next thing that you want to do now is to create a new environment variable for Java home. So click here on new and on the variable name type. Java, underscore home, all in capital letters. And the value will be. The path up to these JDK folder. So you're not inside of the bin folder, you're inside of the JDK folder. Take this path and paste it as a value for the variable, variable. Ok, so you have variable named Java underscore home with capital letters. And the variable value is the path to the JDK folder. Click okay. And you see that now we have the Java home variable, click OK, click OK, and close all of the windows. Also close the command prompt. If you have open command prompt, close it. We want to close everything can start from fresh now. And we want to open the command prompt. Again. You can start typing command prompt or CMD. Open it. And now we are going to check all the Java commands. Now we're going to check first the Java version. So we are going to type Java space hyphen version. And you can see that Mao have Java version 14, 0.01. installed. If you see the version here for you, it might be a newer version by the time you're watching this video. But if you see the Java version here, it means that the Java, Java is installed and everything is fine. Everything's perfect. Actually. You see also the Java Runtime Environment was installed with these JDK. So you don't have to install the JAR separately. The Java Runtime Environment was also installed. The next thing that we want to check these Java C version, which is the command that we use to compile Java files. And if you see the version here, it means that it was installed and that's what you want to see. Basically, you don't want to see some message that says that you don't hear the Java installed. You want to see the version and everything is fine. Now, if we want to see that the the environment variable for the Java home is set properly. We want to type here a coal percentage sign. Java underscore home with capital letters and percentage sign. Again, this is the, the name of our environment variable, the Java home environment variable. So ACO, percentage sign, Java home percentage sign. And after you press Enter, you will see the, the path to the to the JDK where the JDK is installed. So everything that you need, he's working now and you can work with Java and Java related programs. I hope that this video was useful for you, and I will see you in the next one. 3. Install IntelliJ IDEA + Create Your First Java Application: Hello guys. In this video I'm going to show you how you can download and install IntelliJ idea. And we are also going to create your first Java project. So without wasting any time, let's go to the browser. I'm using Google Chrome. And we are going to type in the search box seen Google IntelliJ. And the first link he's going to be from JetBrains.com. So click on this one. And immediately you're going to see the download button. Click here. And you will see that there are two versions of IntelliJ idea. Ultimate version, which is a paid version, and we don't want to install this one. We are going to install the community version, which is a free version, and it's open source project. So click on download. And it will start downloading the IntelliJ idea. This will take a couple of seconds. I'll be right back. Okay, and after this is downloaded and just click to open it, the installation process will begin. So I'm going to click next. This will be the destination folder. And if you don't have any reason to change it, I suggest it does. Default option. Click next. Here, I'm going to select the 64-bit launcher at Open Folder as a project. Click next. And install. Now IntelliJ is being installed. Now after the installation is complete, I will click Run IntelliJ idea Community Edition and click Finish. This will open the IntelliJ immediately. We have to confirm with the JetBrains privacy policy. So I'm going to click I confirm that I have frequent accepts the terms and conditions. Click Continue. Data-sharing. Don't st, we don't want that entry. It's going to open the, the IntelliJ idea. But first thing that we have to choose is the theme, the UI team that we want to use for IntelliJ j. We have two options here. The dark options. Dark killer for actually for a, for a long time I think I was thinking that this is Drucker Dracula, but it's darker. And I'm using this one for development usually, but for creating these videos, I think for you will be better to use the light team because you will be able to see the Cold better. So I'm going to choose satellite, but you can choose the dark team matting, it's much better for the ice. So I'm going to choose light and click Next. Here. You don't need to select anything. Click next here as well. And click Start using IntelliJ idea. This will open this window, which is asking us if we want to create a new project or to import already existing project. We don't have existing projects, so we are going to create a new one. So click, Create New Project. Here, we're choosing Java, which is the language that we want to use for development. We have the JDK version 14, 0.01. if you have watched the previous video, you know how we installed the JDK version. And I'm going to click Next now. Okay, create project from template. Click this one, and click Next. We are going to give this project name. First. Project. Why not? K leaves the project location as default and the base package as a.com. And click finish. And this will open our first project. I'm going to put the on full screen, something that IntelliJ J, He's doing every time when you start it, it's giving you a tip of the day. And it's pretty useful. Especially when you're just starting out. You can learn a lot of new tips and tricks from this in right here. If you don't want to see these everytime you can click dong show tips. But I suggest you leave it open and you can read the tips that they are giving you. Click Next tip and a lot of shortcuts and pretty crafty little things you can learn from here. And I'm usually just closing it and start developing. Now, on the left side, we have our project. So you see that we created this first project. If you expand this, you will see the RC folder inside of it. We have this package, and inside of it we have our main class. And this is where the magic happens. This is from where our program starts. So let's write our first program, our first line of code here. Just what I did. I deleted here. This line writer called here. These two dashes means that this is a comment and this line of code will not be executed. So I'm going to delete it. And I'm going to write system out, print line. And I'm going to write inside a week Hello World. And in order to print these, what these Think, we'll do this, we'll print hello world on the console. And if I want to build this program now, I'm going to right click and I'm going to click Run main. So you can see on the bottom it says built, it's building the program. And after it compiles, you can see Hello world here. So congratulations, you just wrote your first Java application. And actually if you want to, no one shortcut. So instead of writing system.out.print line, every time, you can just write S, O, U, T, south and click top end. This will write it for you. It's a little, just a little shortcut to write it faster. So instead of writing it letter by letter and just type Sultan, Click, Tap. And hello. World, kay, run name. It's building on the bottom. And this is your result. After that, next time that you want to run the program, you can just click here on the top, is doing the same thing. Running the, building the application and running the program, but it's the same thing. You can right-click and click run from here. Or you can click run from here. It's the same thing. So that was it for this lesson. Let's continue with the next one. 4. Understand Basic Programming: Hello and welcome to the next lesson. We're going to learn some really basic stuff right here. I'm trying to keep it simple. And just to show you now what you see on the screen to get familiar with some of the basic stuff that we're going to learn. So the first thing that we see on the top is the package. Basically we just import some packages into your project that your project needs to work. So this is our main class, and inside of the class we have methods. This class starts from here. And this is the open, this is the opening parenthesis, and this is the closing Quan. So it starts from here and closes From here. Inside of the class we have main method. You can see this public static, void, main, string arcs, so ignore most of these things. Just remember that this is a metal, is the name of the metal, which is your, your main method. Your program always starts from the main metal. So this is your starting point. When you run your program. It's always going to execute the code which is inside of this main method in the quote that we have inside of this main method right now is this lime. And because our main method starts from here, this is the opening, the starting point of the metal, these parenthesis, and this is the closing one. So this is the beginning of the metal, and this is the end of the metal. And inside the width, we have this line of code. You can have multiple lines of code inside of one metal. And when you run your program, it's always going to execute this thing first, this is inside of our main method. If we run this program and now it's going to print hello world multiple times because this is what we have inside of our main method. Okay, let's dissect this sentence a little bit to see what exactly is happening. See here. So system is a class in Java, and inside of each class you have methods. So when you type dot after the class name, so I'm going to write system and I'm going to type dot. So inside of this system class, we have methods or functions which are ready to be used. You see that there are a lot of methods that we can use. We can click on some metals and after that hover on it and see what exactly it's doing. You can read from here. But what we want to use now is I'm going to type dot again. And I'm going to see what kind of methods I can use from here. And you see in the first one is print line. I'm going to click on it. I'm going to hover on it and I'm going to read what this metal is doing. So I terminates the current line by writing the line separators drink. The line separator string is defined by the system property line dot separator and is not and necessarily a single new line character. Okay? So basically this is printing on the console. Inside of the method. You need to give this metal song something. You need to pass something to dismantled in order to work. I'm going to put double quotation marks, which means I'm going to give this metadata string. And a string is a sentence or a word. Just remember that a string is a sentence or a word. You're going to learn more in the next lesson when we are talking about variables. But now I'm going to type, for example, this is my first Java program. It's awesome. And this will be the string that I'm giving to this metal. Okay, from here to here, inside of this two parenthesis, two quotation marks. So if I run this program now, right click and run, and you'll see that it's printing on the console. This is my first Java program in it's awesome. Basically, this is what we have so far. Let me show you actually something else. System out and let's choose another method. For example. Instead of printf line, I want to use just print this time. Okay? And by the way, you always close. You finish your sentence with semicolon. So this is like imagine that you're writing sentence just to normal letter or more sentence until you finish the sentence with a dot. Here, in programming, we finish with the semicolon. Everytime when something is underlined with red underline, you can hover on it. It will show you, basically it will tell you what is the problem. Right now. It cannot resolve method print because we don't have anything in the limits. So we are going to write here, my name is victory. You can type your name here and don't type Victor. And I'm going to write another line. System out. Print, loops, system out, print, line. And time going to ride share. This course is awesome. So what do you think will happen now? Just give it a guess. If you think this will be printed after this one and after that, this one. Well, there is a, a little bit of surprise for you. So what happened? This is my first Java program and it's awesome. After that we have, my name is Victor and something happened here. You see, this course is awesome, is written exactly after my name is Victor saw. These are mixed together. There is no new line. So that's exactly what happened. There is no new line. So this method print is printing something on the console, but the next line of code will be executed exactly after this think is executed. It will be executed on the same line. This is what the print is doing. It's printing something on the console, but it stays on the same line, so it prints. My name is Viktor, but after this line is executed here, we're still on this line, on the same line. And after that it's printing. Discourse is awesome right after it, because we didn't say we want a new line when we want to print something and to move on the next line, that's where we are using print and print line. So this will be printed. After that, we will go on the next line. After the distinct will be printed, it will go on the next line. And after that, this team will be printed. If we run the program now, you'll see that now everything is right and everything is on a separate line. So with this, I just wanted to show you the different methods, do different things and just want one simple character can be different here. But the meaning of the metal and the phi function, the thing that the metal is doing can be completely different. So every time read what the method is doing with the time you'll learn. And you'll get more comfortable. And you will know which one you're using can for what exactly you're using them. I just wanted to show you that different different methods have different purposes. So I hope you understand it. Now let's continue with the next lesson. 5. Variables: Hello guys and welcome to this lesson about variables. So let's begin with variables. I'm going to delete these things that we wrote so far. And I'm just going to start typing and I'm going to explain what I wrote after that. So I'm going to create this variable with the name first number. And I'm going to say it's equal to five. So what I just did, int is short for integer. Integer is a data type. Variables can have different data types. The first number is the name of the variable, and five is the value of the variable. So we datatypes, we have some kind of type of variable. So the type of the variable is integer. We also have name of the variable, which is first number in our case. And we have a value of the variable. Our value for the variable first number is equal to five. So what is a data type, ent or water different type of variables. Why do we have different types of variables? Because we need to differentiate numbers from sentences and to round numbers from decimal numbers and things like that. Integer we use when we want to create round number. So integer can be five or six, or seven, or ten, or 20. But it cannot be 20.5. For example, you see that if I type 20.5, we have this error message that the required type is integer, but we have given a double. So what is a double? I'm going to return this to five. Double is a data type that we use when we want to create decimal numbers. So integer we use for round numbers like five, like six, and double we use for decimal number. So double second number is equal to 10.5. Okay? Now 10.5 is correct because we said that the datatype is going to be double. Okay, now have our second variable, which is called second number, its type double, and the value is 10.5. Okay, four decimal points. We can also have float, which is another data type for decimal numbers, but I don't want to get you confused. We are going to use double just to make this simple. Double is more precise than float. So. We're going to use integer for round numbers and double for decimal numbers. So what we're going to use for words and sentences, we're going to use string. Probably you already know that from the previous lesson. So string, we type with capital S. String name, for example, is equal to John Kay. And we always put strings in double quotation marks. So we start the string quit quotation, and we end the string with quotation. So the data type here is drink, the name, the name of the variable, name, and the value of the variable is John. Ok. We can have a full sentence here. John is the Java developer, for example. This is also a string and we can just leave it as John. The next thing that we're going to learn is char, saw, char is short for character and the charge, sir, just one simple letter. We start the characters like strings, but with single quotation, not will double with single and the character, character it just one letter K. So like in strings with start with quotations, but in characters which we start with single quotes and finish with single quotes. And we use characters for one single character, one single letter. Okay? And the next datatype, the next variable that we are going to learn is called boolean. Boolean can be true or false. The value of the Boolean can be only true or false. So we can type here true or false. It cannot be five. For example, this type of variable expects only true or false. Probably we're not going to use this type of variable, but you need to know it. Just to be sure. Let's summarize right now. So we type comments with double slashes. So integer, we use for round number, run numbers. Double, we use for decimal numbers. String. We are using four words or sentences. And okay, char, we use for single character, boolean, we use for true or false. Okay? I will show you now the power of variables. For example, if we want to print our name on the console, we don't have to write system out, print line, deter, like before. I can just use the string that we have created here. Okay, we have a string, this is variable called name, and the value of the name is John. So if I want to print the name John, I'm going to just give the name of the variable here. I'm not going to type double-quotes and some string inside. I'm just going to pass the name of the variable here named. And if I run the program now, it's going to print John because we are printing name which is equal to John. So I believe this is enough for now. Just take this in, write some variables. Tried to print some variables in the console. I believed it. You'll get comfortable with this quickly and let's continue with the next lesson. 6. Getting User Input: Hello guys, welcome to this video. Now we are going to learn how we can get the input from the user. And I'm going to quickly delete all of this that we wrote in our previous lesson. And we are going to get the input from the user with something which is built already in Java and is called scanner. And the scanner is basically getting the input from the user keyboard, whatever the user is typing, and it storing it into a variable. So the first thing that we want to do is to basically get the scanner or tell the, tell Java that we want to use the scanner. So what we have to do is we have to import the scanner. And just remember this, you're going to import stuff into your project that way from now on salt type import Java util dot scanner. And that way we're telling Java that we want to import the scanner into our project and basically we want to use the scanner, okay, so what we want to do now is just follow me. We're going to say scanner. And after that we want to give a name to the scanner, to this variable. So I am going to call mine Victor is equal to. And we want to put inside of this variable whatever the user is typing from his keyboard. So new scanner system in. Okay, so what we did right here is we told Java that we want to use the scanner. And we created a variable called Victor. You can put your name here. And this variable is going to store the value of whatever the user is going to type from the keyboard. So system in stents for input. And the only input that we have is the keyboard. So what we want to do right now is we just want to print it on the screen. And how we are going to do that. We already know the shortcut for a system out print line south and tap. And pay attention. Now we want to print done. We want to say the name of the variable, which is Victor dot, next line. And what this is going to do is going to allow you to wait until you get input from here. So let's run this program now and see what happens. Ok, now, the program is waiting for our input. And if I say five, for example, and press enter, I will get five. As a result, we got because it's getting my input from, from here and it's printing the input on the console. Or if I run it again and say hello there, press enter and I get hello there. So one more time, guys, what happened here? We imported the scanner. We basically told Java that you want to use these Kynar. And we created the scanner variable vector, which is equal to new scanner, which is taking the input from the keyboard. And after that we just print this input. We are seeing system out print line the name of the variable and make slime. We're basically printing on the, on the console, whatever the input is. One more time, run the program. Our input from the keyboard is going to be my input here. Press enter, and we get the input on the console. So that was your basic tutorial on how to get the user input. We are going to need it. Now let's continue with the next lesson. 7. Building a Basic Calculator with Java: Hello guys, welcome to this video. In this video we're going to learn how to create a basic calculator. And we're going to use variables and other things that you have already learned from the previous lessons. The first thing that we are going to need is a scanner and Ty have already imported this Kanner. And what I'm going to do right now is I'm going to create a Scanner variable. So scalar, mine is going to be victor SQL to new Scanner. And I'm going to say system in. Now what we need is three variables. One for holding the first number. The second variable is going to hold the second number in the third number. The third variable, excuse me, is going to hold the, the answer. So we're going to create three variables with datatype double. And we're not going to give them some available yet. We are going to say double first number. You can make it like this, one by one, double first number. After that we can make double secant number. But I'm going to show you one trick. How we can create them faster is just like this. So I'm going to say double first number, second number, and, and answer. Ok, so we have created our three variables and they don't have a value yet. The next thing that we want to do is just to print on the console for the user enter first number. So when the user comes to our calculator, he knows what he's supposed to do. So we're going to see system out, print line, enter first number. Ok. So what this is going to do is it's just going to print enter first number. The first thing that the user is going to see. Now the next thing that we want to do is to store that number, which the user is going to enter into our first number variable. You want that value be the value of the variable first number. So I'm going to say first number is equal to vector. This is our scanner. And I'm going to say next double. I'm saying mixed, doubled because we will have a number. If we are going to have a string, I'm going to say next line, just like we did in the previous lessons. But since we expect a number from the user because that's a calculator. We are seeing mixed novel. Ok. Now what we want to do is to do the same thing for the second number. Now the user enters in the calculator, he sees. A line of text enter first number, he enters the first number and it's stored in this variable first number. Now what we want to do is to type. What I did is just typing is o, u t, you know the shortcut already and clicking top. It's filling it for me, system out print line. And we want to say, now enter second number. And we want to store the second number into the variable second number. So I'm seeing second number is equal to vector dot next double. Okay? Now the next thing that we want to do is you want to have our answer. So we are going to say that answer is equal to first number plus second number. And whatever the value of the first number in the second number is, there will be added and that will be the value of the answer. And what you want to do now is to output the answer on the screen. So we are going to say system out, print line. Answer. Now, if we run the program, we will see that the first thing that we see is a line of ticks enter first number. So I'm going to enter 12 and press enter. Now see enter second number, I'm going to say 26.4. Press Enter, and the answer is 38.4. Now let's make this a little bit prettier. In the last line where we have system out print line, we have just the answer. We can say here. We can put the string the As are 0s, K plus answer. If we run the program now and enter first number 15.62, number 14.3. The answer is 29.9. We just added this drink in the beginning because we don't want just the simple digit here. We want to have the whole line and the answer is 29.9. Okay, so I will walk you through the whole thing one more time. So the first thing that I did was I added, I imported in the scanner. After that in our main method, I created scanner variable victory, so we can use the scanner. After that, I have created three variables from datatype Babel because they are numbers. The next link is just printing for the user entered the first numbers. So when the user comes into our program, he knows what he's supposed to do. After that, we stored whatever these the user is typing on the keyboard into this variable first number using our scanner. After that we are saying enter secant number. The user is seeing that on the screen, we are storing the value of the second number into the secret number variable. And after that we are creating answer variable which is equal to first number plus second number. And we're outputting on the screen, the answer is, this is just a string and we are taking the value of the answer. And that's our basic calculator. Just play with it. I hope this tutorial was useful and now let's continue with the next one. 8. Building a Basic Greeting Program with Java: Hello and welcome to this lesson where we are going to create a similar thing to what we did in the previous one. But this time, instead of creating a calculator, we are going to create a simple program which is going to greet you into this course. So I'm going to delete most of the things. I'm just going to leave the scanner, share. The same thing. We need the scanner imported in the beginning and we are creating a scanner variable, which is victor. Ok? Now I'm going to create two variables which will be string variables. So I am saying string, first name, nth, secant name. This will be, these will be our variables. Now I want to say to the user, enter your first name, so I'm going to print that on the screen. So I'm typing system out print line. Or instead of enter your first name, I'm going to ask him, what is your first name? Actually, I'm asking you what is your firstname? Okay, after that, we're going to store this value into our variable firstname. So I'm saying firstName is equal to Victor dot next line, because we are using a string in the previous tutorial, we used next double because we were working with numbers. But now, since we are working with strings with names, I'm going to use next line. This method is what we need. Okay? We have the whatever the user is typing in the keyboard story stored in these firstname. After that, I want to say to the user to you, what is your second name? After that, I won't store the value of second pin into our variables. So I'm seeing second main is equal to Victor dot next line. So the next thing that I want to do is I want to print for the user the greetings. So I'm seeing system out print line. Welcome to my course. I want to save plug plus firstname plus space plus secant and Taiwan to say plus exclamation mark here. So if I run this program now, you will see what will happen. We have the first thing that we see is what is your firstname? I'm seeing Viktor. What is your second name? Renal, NTC. Welcome to my course. Victor green off. So how exactly we did this? First thing we need is the scanner. We created a variable for the scanner. We created created two variables in the FirstName and the second name. First in that we are printing on the console is what is your first whatever the user is typing on the keyboard, we're storing it into the firstname variable. And because we are using strings, we are using the metal next line. If it was a number, if it was a double number, we were we were going to use next double. Okay, after that, we are printing what is your second name and storing the variable into second name. And lastly, we are printing a welcome to my course, plus firstname plus secant Mmm. And if you're wondering, what is this space right here, and what is this exclamation mark right here. I will show you what will happen if I just do welcome to my course. Plus firstname plus second name. Okay, what is your firstName? Victor Reno. Welcome to my course. Victor green of is just one word because we don't have a space after the first name. You see it gets the value from the FirstName, and immediately, immediately we have the second name. So after the first name, we want to put one space, tufte r dot plus second name. And if you want to say to put a dot at the end or exclamation mark. I'm just giving it hears all plus exclamation mark, if I run the program now, Victor, were enough. Welcome to my course, and I hope that was useful. Now let's continue with the next lesson. 9. If else statements - Your First Code Logic: Hello and welcome to this lesson where we are going to learn if else statements or conditional statements or our first coat logic. So without wasting any time, I'm going to delete the things that we don't need from our previous code. I'm just going to leave the scanner because we are going to need that. Now we are going to create a program which is going to check based on logic if our age is below 18 years old or higher than 18 years old. Because in Europe, if your, if your h is below 18, you are not allowed to enter bars into drink alcohol. So we are going to create a program which checks, is your h lower than 18? If so, you're not allowed to enter in the bar. If you're age is 18 or higher than 18, then you're allowed to enter in the bar. And how we're going to do that. First, we need a variable H, which is going to store the, basically it's self explanatory. It's going to store the h. This will be a number, so we are seeing integer H. Now the next thing that we need is we want to say to the user, we want to ask the user what is your h? So we are going to say since system out print line, because we want to print this on the screen. This question, What is your h? We're asking user The first thing after he comes into our program, we're going to ask him what is your h? Now, the next thing that we need is we need to store the age of the user or the input that he's giving us into this h variable. So we are going to say h is equal to victor, which is our scanner. Next, int, because R h is integer. So now we have the age of the user and it's time to write our logic. Now, the interesting part comes here. Now you are going to learn how to write if else statements, your first coat logic. So we are going to say if h is lower than 18. And whatever you put here between these curly brackets here is going to be executed if this statement, if this if statement is true, so if h is lower than 18, we want to print on the console. Sorry, you are not allowed to enter. Basically you're too young to enter our bar. Now, the other case is, if the age is higher than 18 or equal to 18, actually, we want to allow the user to enter the bar. So we are saying else if. And here in the else if statement, we are saying if h is higher or equal to 18, we want to print on the console. Okay? You are allowed to enter the bar. Now what is going to happen? Let me explain this program before we run it. We have this logic right here. If and else if, which is going to check if our user is younger than 18 years old or his H0 is equal or higher than 18 years old. So we get this, the user's age from the scanner that we created here. First we have the integer H variable. After that we are asking the user what is your age? After he gives us his age, we're storing int it into this variable h. And after that we are taking is h lower than 18? If so, we want to print on the screen, sorry, you are not allowed to enter. The other case is if his h is equal to 18 or higher than 18, we want to print on the screen, okay, you are allowed to enter the bar. You can play with this if you're from the state, for example, I think the h will be 21, which is allowed to enter bars, but you get the point. So if we run the program now, the first thing that we see on the screen is what is your h? So I'm going to type 16. And the program will tell me, Sorry, you're not allowed to enter because we got into this if statement case. So if your h is lower than 18, which is our case, 16, we want to print this on the screen. Sorry, you're not allowed to enter. If I run the program now and I say my age is 18, we will get the else if statement. So is your h equal to 18? Yes, it is. Now, I want to see you on the screen. Okay. You are allowed to enter the bar. If we run the program again, MSA did my age is higher than 18. If I say 35, For example. I will also get into these case. Okay, you are allowed to enter the bar. So one more time, we print on the screen, what is your age? We ask the user, we store the input data that he's giving us into this h variable. And after that we have the logic here. If the H is lower than 18, print on the screen that he's not allowed to enter in the bar. If he's h is equal to 18 or higher than 18, we want to allow Him and we want to print on the screen, okay, you are allowed to enter the bar. I hope that you get these tutorial, this lesson play. We did write it a couple of times. I'm sure that you'll get better and better. Now, let's continue with the next lesson. 10. Switch Statements: Hello and welcome to this video where we're going to learn switch statements. Or you can also say conditional statements. They are basically doing the same thing like the if else statements. You're writing logic. But some people say that the switch statements are more elegant way of writing conditional statements. I'm, I'm going to show you how you can use them. It's basically the same thing that we did here with the if else statements, but we are going to use switch statements and this time. So we also need the scanner, we also need the h variable, and we also want to print on the screen, what is your H? The first thing that we want the user to see, and we want to store this input from the user into the age variable. Now, instead of if else statements, we want to write switch here. And we want to put H into the switch. And basically we want to create our cases here. So in the first case, we want to see if the user is lower than 18. So we are going to create case 17. You're 17 years old and we want to print on the screen, sorry, you are not allowed to enter. Come again next year. This is our first case. After the case, we have to break and we are ready to type our second case, case 18. So if the user is 18 years old, we want to print on the screen. You barely made it come in because he's exactly 18 years old. We'd have to type break again after the case. And we are writing our third case. If the user is 919 years old, that's how you do it. So after the case, we want to say, OK, old guy, you can come in. And we need to break after the case again. So what we did here, we created a switch and we need to put our age variable here. After that, we have three cases. In the first case, if the user is 17-years-old, we want to say that he's too young, ends he is not allowed to enter. If we have the user enter 17, he will get into this case here. If the user enters 18, he'll get into these case, which will print on the console. You barely made it come in. If the user enters 19, which is our third case, he'll get into these keys here and it will print, OK, old guy, you can come in. Basically the same thing that we did with the if else statements, but it's a different way of typing conditional statements. Now, let's run the program and show you exactly how it works. Now I run the program and the first thing what they see is what is your H? This comes from the thing that we did in the beginning. We are printing. What is your age? And the user answers 17. Sorry, you're not allowed to enter. Come again next year. This is our first case, 17. So if we run the program again, and this time I typed 18, we'll enter the second case. When he's 18 years old, we want to print on the screen. You barely made it come in. Okay. And and if I type 19, we will enter the third case. Ok, old guy, you can come in. So basically, you see how it works. You can use if else statements, if you like them more or you can use, use switch statements, try them both, C, whatever you like more and use that one. This is my suggestion. Now I hope that this tutorial was useful. Now let's continue with the next one. 11. For Loops: Hello and welcome to this lesson where we are going to learn about loops and more specifically about for loop. But before we start, I want to thank you so much for being here and watching this course. I want to tell you that you are amazing and denoted programming is difficult. But you're trying into your improvement, improving. And I believe that you'll get better and better. And you'll reach your goals because you're improving and you're trying to learn new stuff which is difficult. And you're amazing for that and thank you for watching this course. Now, what is a loop? A loop is a smart operation which allows you to do one thing many times. And you can write logic kinda loops and you can modify them, and you can play with them in order to reduce the times that you're doing something. Let me show what is, show you what I mean. For example, if you want to print numbers from one to ten, for example, your, we are going to use this example again. So let me remove these things here. And I won't print the number one. I can just say system out, print line one. System won't print line tool system out, print line 345678910. If you're wondering how, how I'm hoping this line without selecting and copying and pasting, I'm using control plus d. And it's making a copy of this line in the second line. And now I delete with control and z. Control and z like that. Okay? So this program is going to print the numbers from one to ten. But you're wondering yourself, is there a better way, a faster way to print these numbers? Because now, okay, it's pretty easy to print them from one to ten. But if we want to print from one to 5 thousand, and if you want to print from one to 10 thousand, are we going to write this line of code 10 thousand times? Of course not. We are going to use loops. So if we want to print the numbers from one to ten using a for loop, this is how we do it. We write the keyword for. And inside of the loop, just bear with me. I'm going to explain in a second. We're writing integer i is equal to one. I is less or equal to ten. I plus, plus. And we give the curly braces. And here we want to print I. So, so what is this? Think I'm going to do for us this for loop. It's going to print the numbers from one to ten. But we don't need to do it line by line like we did previously. We are going to do it with a for loop. The first part of the loop, int i is equal to one, is initializing of this index, i mean means index here. So we are saying that this index is going to be equal to one. You can think of this like the starting point of the loop. We are starting from this number right here. We're going to start from one. I is less or equal to ten. You can think of this like the end part of the loop. The loop is going to end when it reaches this statement right here, when i is less or equal to ten. And we need some action here. So we have this increment part. Every time when the loop, when we're looping through this code is going to increase, increment the i width one and we're printing i. So the first thing that is going to happen when we come into the loop, it's checking how much is i? I is one is equal to ten. No. Then print i on the console and increment i saw the second time I is going to be equal to two printed increment. Again, it's going the third time is going to be three. Is it equal to ten? No, then printed increment again, and so on and so forth. Let me show you as they start the program. And it's printing 12345678910. Like I told you, this is the beginning of the loop. This is the end of the loop. You can really easily modify the loop share by saying, I want this to loop from one to 123 is the 100, this is the end part of the loop. Then it will stop. Let me show you. Now it's printing the numbers from one to 101 more time. This is the beginning of the loop. We are starting with initializing i. I is equal to one, the index is one. The second part is the, you can think of it like the end part of the loop. Loop is going to, to end when it reaches this 100th. And on each iteration is going to increment i. So i is one. The first time when we when we come here and print the second time, it's going to be two. We're going to print two. The third time is going to be three. We're going to print three. After that is going to increment again, it will be for print, for increment become 5.5 and so on and so forth. It's much smarter way to print numbers and you're going to use loops for a lot of operations. You can put inside of the loop if else statements, for example, to make the logic, the even more complex, whatever you need for your program. So that was just a simple for loop showing you what it means and how you can use it. You will improve and get better as you experiment and try, try to use them more and more inner programs. I hope this lesson was useful. Now let's continue with the next one. 12. While and Do While Loops: Hello and welcome to this lesson where we're going to learn how to use while loops. And basically what we are going to do is the same thing that we did in the previous lesson. We are going to print the numbers from one to 100. But this time instead of using the for loop, we are going to use a while loop. And I will explain to you how you can do it and how, and what is difference between the two loops. So in the for loop, you see that in the first part, we initialized this I, this index here. We are saying that integer i is equal to one. In the while loop. You, you write it like that. We put our condition here between these brackets here. But in the while loop we don't have our variable. So what we have to do is we need to initialize this integer i, this variable before the loop. So I'm seeing integer i is equal to 0. So here I can say, while i is less or equal to 100, then I want to print i. And I want to increment every time when I come into this loop. This thing right here is the same, like this thing right here. Let me comment this loop for a second. Let me run this program just to show you how it works, is doing the same thing, it printing the numbers from 0 to 100. So if I say that I here is one, actually, it will be exactly the same program like the previous one with the for loop. Now it's printing the numbers from one to 100. So what we did here, we're saying to our program, first of all, we are saying that i is equal to one. This is our variable and it's equal to one. After that, in the while loop, we are seeing while I is less or equal to 100, I want to print i and I want to increment i on each iteration of the loop because the program is coming into the loop, is checking. How much is I one right now? Is it less than 100 years? Then it's coming inside of the loop. It's printing AI. And after that, it's incrementing. So the next time when we come to the loop and we check how much is I. It's too that way it's going to print 12345. You need this increment part, which is equal to this increment part in the for loop. If we don't hear it here, you will see what happens now. If I delete the increment part. It's going to run and run and run. And this program eventually will crash because this is infinite loop. It's never going to stop because this, I will never be lower than 100 dots. Why we need to say i plus, plus, we need to increment i each time. Because if we are not incrementing, i is always equal to one and it's never going to come out of the loop. It will come here. Check how much is i. It's one less than 100. Okay, then print i. And next time I will also be one because we are not incrementing. And that's why the loop is infinite. It's never going to go out of the loop. So after printing, i need i plus, plus. The same thing like we have here in the for loop. This thing right here that we're on right now with a while loop is the same like this for loop that we did before. Now, there is another type of loop which is not used really common, but I want to show it to you. It's called do-while. And we're saying Do this code right here. While this condition is true. So I will say here, I is less or equal to 100. This do-while loop. We'll do the same thing. Actually, we have to increment here, have to say i plus, plus. And what is going to do? It's going to do this, right? This thing right here. It's going to print i and increment while I is equal or less than 100. So if I comment this while loop and I run the program, you will see it's going to do the same thing. It's printing the numbers from one to 100. Do this. While this is true, it's the same concept, the same think. You can just use three different types of loops to do, to do it. So the first type of loop is for loop. Second IPs while, and the third type is do while. Most probably you're going to lose four loops more often. But it doesn't hurt to know the other ones and actually it's pretty useful to know them. Sometimes you might want to change things a little bit. Just wanted to show you the while and do-while loops as well. I hope this lesson was useful. Now let's continue with the next one. 13. Methods: Hello and welcome to this lesson where we are going to talk about metals. Or if you have heard of functions, it's basically the same thing. Metal and a function is the same thing. You're using methods to make your code more flexible, to use functionalities. And I will show you now what I mean by this. So for now we have been using only one methods, the main methods right here, and the main method, all that we have is between these two curly brackets. So anything that we write right here is the body of the main metals. Now we are going to create another metal which will be outside of the body of the main method. So we are going outside of these brackets and just type what I'm typing. Public, static, void. Just bear with me. We will explain in a second what that means. Now, type the name of the method. For example, if we want a method or function that is going to greet the user, let's say that the name of the metal will be green. User. We put arguments, but for now we are not, we are not going to put any. So this mental, We want to simply to greet user saw inside of this metal, inside of the body of the metal, we will say system out print line, shallow, user. And now what we can do, what's the cool part is that you can invoke methods from other methods. Now, we are going to go into the body of the main method. So inside of this method right here, and we're going to call the greet user metal. So I am saying, great user and I'm running the program. And guess what will happen? It will print hello user. Basically, this main method right here is calling the great user method. And what the greed user method is doing. It's printing on the console. Hello user. Now let's create another method. Let's delete this one. And let's make multiply metals and metals function that is going to multiply two numbers. So we're seeing public static, void. Multiply. We can just say multiply or we can say multiply two numbers. And here we want to put arguments which will be the two numbers. So integer first number and integer secant number into what we do is to print the first number multiplied second number, ops, multiply second number. Okay? Now if we call the multiplied. Two numbers method from the main method. Now we have to give the two numbers that we want to multiply. So inside of this method, we want to say, for example, 510. If I run the program now, this program is going to return the to the multiplied numbers. So five multiplied by ten is 50. We're calling this method multiply two numbers from the main metal. So if you're wondering what these public static void mean, public basically means that this method can be called from anywhere. It's not restricted. It's not, it's not going to be used only from one place. Public means that we can call this method from anywhere in the program. It's not private, it's, it's the opposite of private. And these, these void is the return type of void means that this method is not returning anything. Now, this metal, we can put return type integer because, because it's returning the two numbers, which is a integer digit. But right now, what we have to do is we want to say what this method is going to return. So we are saying return first number multiplied by secant number. Now, if we run the program, it's not going to to say anything. We're not going to see anything because previously we had the system out print line, now we don't have it. So what we have to do here is system out, print line, multiply two numbers, and here we give the two number. So for example 312, I'm going to just delete this line. Now, if I run the program, we will see the two numbers multiplied 312 is 36. The return type is integer. We have to say return and what is going to be returned. And if we want to see that, if you want this to be printed out, we say system, print, system out, print line, and we call the method. Let's create another method, for example, public static, integer, two numbers, for example. And this method is going to add the two numbers. So integer number one, nth, integer number two. And it's going to return number one plus number two. Ok? And if we call this method now, we say that we want to print it first and we say. Inside of the system out print line metal. We are going to call the add two numbers. Soul, we are seeing at two numbers. And we want to add the numbers 1520, for example. Now, if I run the program first, I will see the number 36, which is the multiply two numbers. Metal 312 multiplied is 36. And the second line, 35 is the add two numbers. Metal Number one is 15, number two is 20, and the result is 35. So we can say here, before the multiplying numbers, we can say system out print line. The two numbers, motif flight, r, k, actually only print, not printf lines. We want to be the number you want to be on the same line. And after that we have the two, multiply it numbers. And before the add two numbers, we want to print the two added numbers are. And after that we have the metal. Now, let's run the program. I think it will be more clear like that. Now, the two numbers multiplied our 36 and the two numbers are 35. First, we created this multiply two numbers method, which is public, the opposite of private, the public method you can use from anywhere. We can call this method from all the other methods that we want to call it from. And the return type is integer. Multiply two numbers metals. Basically it's multiplying first number and second number. That's what it's returning. First number multiplied by second number. And here we are calling the multiply two numbers and we're giving him the two numbers that we want to multiply. The second method that we have is at two numbers, which is returning number one plus number two. And when we call this method from the main method, now, look, we're inside of the main method right now. This is the body of the main method. And inside of the main middle, we are calling this add two numbers method. And we are giving the number 15 and number 20 is going to add them, and it's going to give us the result 35. Now, that's how you use methods, how you create methods, how you decide the return type II, if it's going to return a string, you can say string here. And that's how we use methods or functions. They are making your code more flexible. And the more you use them, the more you understand the benefits of methods. And they will make your code look prettier and more tidy. You don't want to have everything in the main method in your program. So calling metals, metals from another metals from another classes, it's going to be really useful for you. That's how you create, and that's how we use metals. We invoke them from the other places. I hope this tutorial was useful. Now let's continue with the next one. 14. Arrays: Hello and welcome to this lesson where we're going to learn about arrays. First of all, I want to thank you so much for being my student and watching this course. I know that it is difficult and this topic is not something easy. But thank you for staying with me. Thank you for learning and you're amazing for doing that. And now it's difficult. Just continue pushing, continue learning a new job. You will get better, I promise you. Now, arrays is difficult topic. It's not something very easy to understand if you're new to programming, but you get used to it after time just and we tried to experiment and to use them and to try and to fail and to try again, and you'll get better. I promise you. Now, array it just something that you store information in. You can think of array like, like when we create a variable integer, for example, we're storing one integer into these variable. Array is multiple, can be array, can be multiple integers stored into one place, one array. If the array type is string, for example, storing multiple strings into that array. For example, if our array is from type string and we are want to save names into this array. We can say named Victor, named Yvonne, named Joshua, name, Peter. All of these elements are going to be stored into one array, which is of array type string. Now, let's stop talking. I'm just going to show you, we're going to create one integer array. And after that one's drink RA. So let's start with the integer array. We are saying int. After that we put these square brackets, which is, which means that we are creating an array. Now, our array is going to be called numbers. Now we have to put the name of the array. So integer square brackets, numbers is equal to nu, integer square brackets. And inside of these square brackets, we need to say how big is going to be our array? How many elements is going to consist in these array? So if we say five, for example, now we created an array named numbers that have five elements inside of this array. Now, something that is far from the human thinking that you need to understand in programming is that programming Q always start counting from 0, not from one. Now, this array have five numbers inside the wit, but let me show you how this array looks. So now we have this array which have. Which have value number one, number two, number three, number 45. Now, this is our array. Okay? There are, like I mentioned, you always start counting from 0 in programming. And when we are talking about arrays, you need to know what is an index. Index is the place of this element right here. So this element, let's say the value of this element is going to be one. But the index of this element is 0. You start counting from 0. So this is element index 0. This is element on index one. This is element on index to. This element is on the index three, and this element is on index for. So this is the index of the element. And this right here is the value, the value of the element. So right now, element on index 0, value of one. Element on index one have value of 0 because this is the default integer value. If we don't put anything here, it will be 0 zeros the default integer value. Now element on index to, let's say it's going to be five. Element on index three is going to be six. And elemental index for, let's say it's going to be ten. Now, let me show you how you initialize these numbers. So right now, our array doesn't have all the values are 0 because like I mentioned, the, the default value of the integer is 0. So right now, if we want to print numbers and element on index three, for example. And we run the program. It's going to print 0 because right now we have five elements, but all of them have the default value of 0. If we want to initialize these elements and we want to give them some different values. We can say numbers. I want the element with index 0 to be equal to how much we say it here, it's going to be equal to one, okay? Numbers with index 0 is going to be equal to one K. Our second element is. This index right here, index one, and the value is 0. So let's change actually this value. Let it be, let's not be 0. Let's make it 25, for example. Now, how do we do this with our code? We say numbers. Element on index one is going to be equal to 25. Now, if I print here numbers element on index one, it's going to print 25 because our element with index one, we have initialized it and we have given it the value 25, just like we have here. Okay? Our next element, elemental index two, is equal to five. Let's write this down. Numbers. Index two is going to be equal to how much did we say five, okay? Okay, element number three on index three is going to be equal to six. K three is equal to six, and index four is equal to ten. Okay? Index four is equal to ten. Now, if we run the program, and let's print something else. For example, let's print all of them. Let's print numbers with index 01234. Now, it's going to print all of the numbers that we have in our array. Now, our array is full. Luckily mentioned. It's, you can imagine an array of one place that you are storing information inside of this array, we are storing numbers. And the type of the array is integer. And we have given values to each, to each element of the array. Now, this array has five elements, and the first element with index 0 is equal to one. The second element with index one is equal to 25. The third element with index two is equal to five. The fourth element with index three is equal to six. And the fifth, the last element with index four is equal to ten. Just like we wrote here. Index 0 is the first one because we are starting to count from 0. In programming, we are not starting to count 12345, like we are doing in normal life in programming who starts from 0. So we have five elements, but the numbers of these elements in the index of these elements are 01234. And our element, the first element is with index 0 and the value is one, just like. We created it in, in our program. Okay, now, let's create another array, width. Width names. For example, like we mentioned in the beginning of the video. So we're going to say string names is equal to nu shrink of three names. Now we have created an array with type string and the name of the array is names. Now in this new array, we only have three elements. So it will look like this. 123, ok, this is index 0, index one, index number two. Here we will store our names. So for example, firstname will be vector. The second name will be i1, for example. And the third name will be Jack. Okay, let's write this code in our program. Now, we have the array with length of three elements, but we don't hear the elements. So what we need to say is names 0, index 0 is going to be equal to vector k. Names on index one, element on index one. So the second element is going to be equal to I1. And names on element, element number three on index two is going to be equal to Jack. Okay? Now, if we print names on index 0, what do you think is going to be printed? Let's delete this first part. Okay? So we have this string array that you have three values. The first one is Victor, The second one is jagged, and the third one is Jack. So index number 0 is equal to Victor. So if we print on the console right now, we will see Victor. Now let me show you another way of initializing the array, which is faster. So if we say string names, two is equal to. And we can directly give the names right here. And we say Victor, iPhone, and Jack. And now we say system out, print line names2 on index. Two. For example. It's going to print, what do you think it's going to print? First of all, it's going to bring print victor because we are taking the 0 index 0 of the first array, which is Victor. And after that it's going to take the index number two from the second array, which is 012. It's going to print a victor and Jack. Now, that's exactly the same, just like the first array. But instead of saying that, first we give the index and after that we are seeing what is the value of the index. We're directly saying, what's the value of the index? So the second array is called names2. The type is also a string, but we are directly seeing the various sole Victor. Index 0. Index one will be i1 into index two will be jock. Just like we draw it here. It's a shorter way of initializing and creating arrays. Now I know that this concept of starting to count from 0, it's, it's a little bit difficult to understand. It's a little bit weird in the beginning, but you'll get used to it. Trust me, you'll get better. I hope that this tutorial about arrays was clear enough that you understand something, start using them, you will get better. Now let's continue with the next lesson. 15. Classes and Access Modifiers: Hello and welcome to this lesson where we're going to learn about classes. Now, let's delete everything that we have so far and see what we're working with. Now, we have one main class that we have been working with so far. And the name of the class is main. You can see it here. It's a public class called main. Inside of that class we have this main method. Okay? You can see on the left side of the project where the class is standing. So usually you will have your project name on the top after that. If you have CRC, SIR, as our C folder, and right here I have com DOT company. This is the package. And inside of this package I have the class main. So how to create another class on top package of your class? Right click, so I right-click here on the condom company. This is the package that I hear from the project and selecting new Java class. So right-click here new Java class, and I'm giving this class on name. So let's create one class called animal. And I just click enter. And as you can see here on the left side, there is another class, right next to the main class. It's a public class. It has the same package because we created it from here. And the class name is animal. Now, let's give this animal class some properties. We will say that this animal will have a name. So the name is going to be equal to, look, this will be the name of our animal. Loci will be ten years old. So we are creating a second variable, integer h, which is equal to ten. Now let's talk a little bit about access modifiers and what this means. It's how you're going to retrieve data from a class. For example, right now the access modifier of this animal class is public, which means that we can retrieve data from this class from anywhere in our project. For example, if I want to take this animal's name or age from another class, we connect these classes in. We take the data from this class without problem, because this class is public. If for example, we create, we make this class private. This means that we can not retrieve data from this class, from another class is it's only available inside of this class. So we can use all of these variables in everything that you have inside of this class. Only in this class, it's a private class. You're not allowed to use anything from the class from outside of it. And static. Means that this class is associated with the type and not some other instance of the type. I am not going to dive deep into this and just remember public and private as a beginner. That's enough for you. Now let's create this class public. Class is by default, are private. So if we don't say anything before the class, by default, it's going to be private. So this is something about class, about access modifiers, excuse me, that you need to learn as a beginner. Need to know how, how, and when to use public and private classes and static as well, but it's a little bit more advanced, so you will learn about it later. Public class. You can take the information from meat from anywhere inside of the project. Private class. You can use the information from the class only inside of this class. Access modifiers we can also use for variables, for example, this integer h, If I say before the integer private. Now these variable age is going to be private variable and it can be used only inside of this class. We can take these variable from some other class. We can do the same with the string. And these two variables now are private and cannot be, cannot be taken out of this class. Okay, let's remove this private thing from here. So what we can do right now is we have this class anymore and it's public class, so we can use it from other classes. Let's go again in the main class, if I click here on the left side or here, I can switch classes from here. In IntelliJ j depends on the IDE that you're using. For Java. I like Intel, you j. So I am going into my main class and now I want to create specific animal. I want to create one doc for example. So using our animal class that we created previously, I'm going to create an instance of the close in time. I'm going to create a doc. So I'm saying anymore dog is equal to nu anymore. Okay, we have just created a dock from our animal class. And inside of our animal class, you remember that we had the name and age. And for example, if I want to take the dog's name, for example, I can say print me anymore. Print me actually doc dot name. And if we run the program now, it's going to print, look, because this is the name of our animal. Now in our main class we say print doc dot name. If we say print doc dot h. It's going to print loci and after that, ten than the age of the dock. Now let me show you something really interesting and important in programming, which is called overriding. What we can do is we can change the name, the name of the dog inside of our main class. So let me refresh this a little bit inside of the animal class, we have a string name, which is located in southern. Inside of the main class, we have created our doc, which is an animal, and we are printing the dog's name and dogs H. Now, if I want to change the dog's name from here in our main class, I can simply say doc dot name is equal to NI. Can say Jeffrey for example. Now, if I run this program, now suddenly our dog's name is Jeffrey, but we have to print that name if we run the program. Now, the beautiful part of this is that you can be really flexible and change your code. That's called overriding. The first thing that the program is doing, it's printing. But dogs name, which right now on this line, right here, the program is reading line by line. On this line, the dog's name is looking. So it's printing looky here. The second line that we have in our program is printing the doc H, the dogs h, which is ten. After that, we're overriding the dog's name by saying dot doc, dot name is equal to j free sold. The name is not looking anymore. We're changing the value of the dog's name. So we're overriding the dog's name. Now, the on this line, the name is becoming Jeffrey. And after that, we are printing the dog's name again. That's why it's saying Jeffrey here. So first it's lucky. After that we're printing the dogs age, which is ten. And after that, we're creating a new name. So we're not creating a new name. Actually. We're changing the name that we already have from lucky to J free. And we are printing the dogs name again in the new and updated name is Jeffrey. We can also say doc dot h is equal to five. So our, our dog suddenly became younger and we are printing the lock H. Now, what we are going to see if you were in the program is, is that we changed the H on the locus. Well, first it was lucky, it was ten years old. After that, we overwritten the name, over write the name. It became Jeffrey. And after that we overwritten the H. The H is now five. So you can be really flexible. You can access a class, use something from the class. We are using the name and the age from the Animal class. But after that we're overriding them from this line right here and this line right here. Now, I want to show you something else. I'm going to delete most of the things. I'm going to leave our dock here inside the domain class. And inside of our animal class, I'm going to create a metal. So I'm saying public, void, print. This method is going to print our name and our h. So the name of the dog and the age of the dock salt printing. Name is plus name, laughter dotted sprinting. H plus H. Ok. So the interesting part now is that we can use this method from the other class that we have. This metal is right now in the animal class, but we can go to the main class in here, we can say dog dot print. And now if we run this program, if we run the main class, it's going to say name is Lucky, H is ten years old. We created a method inside of the animal class that we have, which is printing the name and the age of the dog, which are variables inside of the animal class. So this print method is inside of the animal class, and we're invoking this method from the other class, from the main class we are calling the dock dot print. So we have created our dock inside of the main class in we are using the function of the, the doc chef, the middle div that this doc cap. So this is how you create and use classes and use variables and methods from other classes. I hope this tutorial was clear. Now let's continue with the next one. 16. Thank You!: Congratulations for finishing my whole course. Thank you so much for being my student and for watching all of my videos. Thank you again for being my student. I appreciate you so much. And if you have any feedback and suggestions, please leave me a message. I'm always improving on my courses. I hope that you get the value that you came here for and I hope to see you in my next courses by.