Java Fundamentals with NetBeans | Christoph Tornau | Skillshare

Playback Speed


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

Java Fundamentals with NetBeans

teacher avatar Christoph Tornau, Java Software Developer

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

26 Lessons (1h 48m)
    • 1. 01 - Introduction

      3:58
    • 2. 02 - Download Java and NetBeans

      2:31
    • 3. 03 - Installation of Java and NetBeans

      2:14
    • 4. 04 - What has been installed?

      4:00
    • 5. 05 - First Project and First Start

      2:54
    • 6. 06 - What happened?

      5:12
    • 7. 07 - Variables

      7:04
    • 8. 08 - Explanation: Variables

      4:23
    • 9. 09 - If-Statements

      6:35
    • 10. 10 - Explanation: If-Statements

      12:43
    • 11. 11 - While Loops

      3:54
    • 12. 12 - Explanation: While Loops

      5:38
    • 13. 13 - For Loop

      2:31
    • 14. 14 - Explanation: For Loops

      9:01
    • 15. 15 - Switch Statement

      4:33
    • 16. 16 - Explanation: Switch statements

      2:53
    • 17. 17 - Assignments and Operators

      6:00
    • 18. 18 - Explanation: Assignments and Operators

      2:56
    • 19. 19 - Methods

      7:14
    • 20. 20 - Explanation: Methods and their Invocation

      4:07
    • 21. 21 - Classes and Objects of Classes

      5:19
    • 22. 22 - Inheritance

      3:11
    • 23. 23 - Class Variables

      4:06
    • 24. 24 - Modifiers

      5:19
    • 25. 25 - Explanation: Classes

      5:54
    • 26. 26 - Where to go from here?

      1:56
  • --
  • 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.

25

Students

--

Projects

About This Class

This class is about the Java fundamentals. You will learn how to install NetBeans and how to write first little programs. From this point you will be able to go onward to dive more deeply into the programming language.

Meet Your Teacher

Teacher Profile Image

Christoph Tornau

Java Software Developer

Teacher

Hello, I'm Christoph.

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.

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. 01 - Introduction: Hello and welcome to my course the fundamentals off the Java programming language. I teach this course as the beginner's course in programming. You need no other basic knowledge about programming language. You can just start from the scratch within this course. On the other hand, I won't go very deep within this course. It is only a short course, and it teaches you to get your first program running on a few commands. It's not teaching you everything about Java, so you're definitely not an expert after this course. If you really want to learn the language, you must go further from here. But, of course will help you, for example, to get your first exercise given out by your professor done or just to create your first program. If you run this course in your free time, I will teach you how to ride commands and java. How to create If statements and wire loops and four loops and switch statements, I will teach you what methods are and how they are invoked, and I will teach you about classes and about inheritance off classes and about how to create objects out off these classes within the Java programming language. Java is a very good start for programming language because Java is very widespread. Java is used in many desktop applications. It's also familiar on the server side. Many huge applications, for example, bank applications or online shop applications are implemented within this programming language Java, and you can get into this area if you're more familiar with the language. The Brennan image was also present on Android devices, especially on smartphones. Where can program APS within the large Java language, also to mention Java language is also available on all our neighbor Planet Marks. The master overs are programmed with the Java programming language, so Java is really very widespread, and it's a good start for learning programming, and I want to teach you the very basics about this in this course. Additionally, I will use a development environment and I e, which is called net beans. Within this course, they're a bunch off ID's available in this area. But I just met beans because it's very easy to install and it's bundled within the Java language. So to get your first program running, you just need maybe 50 minutes and then you're done. This is all included within this course and within this Net Beans I d. As it'll cost description order, he says. My name is Christophe Tona, and I'm a software developer or software ash ticked. I'm the person we can teach you programming Java programming language because I'm used to program in the jail, a programming language for many years. I also do this as my business and have my main income by programming Java programs. And these programs run on a lot of big systems, and many people are involved within the Spruance. So I'm really expert in this area, and I'd like to teach you the very basics about this. I'm based in Germany. I'm a native German, and on the other hand, I want to apologize. My bad English. Sometimes you maybe get a problem understanding my English, but I will do my very best to give you the best experience in this course. Thank you for tuning in and let's start the course within the next video 2. 02 - Download Java and NetBeans: to start programming. We first off all half to don't load Java and we also have to Don't note off course next beads and we have to install java on. We also have to install net beans on our local machine. Java is available from the website w w dot oracle dot c om I already entered the website. You are l here in the top and then you choose menu and then doughnuts and triumphs then then java. And then here Old Java don't loads. And you see this page a lot off information is available here. We need the Java Standard edition and the Java Standard edition is available here. Over here it's called Java s I click on here and now I come to the Donald page off the Java Standard edition and I can choose between Java, only Java and here Java with net beats. If this menu is this navigation at the Oracle website changes, you can also Google Java s e don't load or java e net beans don't load and then you will also get a list and you click on the list. And you also find here the Java Donald Page where you can choose the single java and java with net beans. I click on the net, beans, java and then I choose accept license agreement. And down here I have to choose the right version for my computer. It's available for Lee Knox for Mac OS and for Windows 32 bit and 64 bit. Also for Lennox 32 64 bit. My machine is a Windows 10 machine, and it's running on a 64 bit CPU. So this one, it's a right one for me. I click on here and the Broza starts toe. Don't note my java bundled with the beats, and in the next lecture we will install this bundle and it will install Java and net beans for us. 3. 03 - Installation of Java and NetBeans: So let's install the file. We just don't load it. Let's install Java and let's install Net means I simply click on the fire. We just don't load it. It's now here on my desktop and after accepting that this file has administration rights to install on my machine, the installer just starts. It's showing me a screen what is installed now, and I simply click next and I choose the location where I should install the J. D. K. Or where the installer should install the J. D. K on its OK toe. Leave this location. I click next. I choose a location where net beans is installed and where net beans should look for the GK . Everything is okay. I click next. I can also leave this check for updates and I click install and that's it. The installer is installing me the net beans up on the top off Java. That's it. Net beans and java is installed, and I simply can click Finish. Now I see this new I can here on my screen on my desktop, I simply can double click this icon. It's a net means e April 2. I can hear for later versions it will be may be different. I simply double click it. And the Net means e. D is starting right now. And that's the start. Page off the net means E. And we will continue here in the next lecture. 4. 04 - What has been installed?: What did we just install? Let's have a small summary on. Have a look off what components we installed on your computer system. First of all, there was the operating system. My operating system wasa Windows operating system Windows 64 bit. But maybe you have to download another channel version, for example, for we knows 32 bit or for a Mac OS machine, or even for she. This was pre installed by you and on top off this operating system, we installed the Java developer Kit J. D. K. Abbreviated. So the Java developer kit provides us with the Java and on top off the Java developer kit. We installed integrated development environment, an I D e and this integrated development environment. Waas. Net means So what's the tasks off all these parts? First, the integrated development environment. You can think off it as much. Enhanced texted little Net beans is actually only a text little, but with many features who helped which help you to navigate between the fires which help you to show what's in the files on bond. Have ah, look in the Java coat. There are many features of favor, but actually it's only a much enhanced text editor and the Complete Java program is normally written in such until grated development environment when the Java program has to be started. Its the task off the Java developers kit. First, the J T. K. Takes care off compiling the Java program. A compiler is just a translator. That translates the program in machine readable coat so on the program is taken, and then the compiler run and then out of the compiler. It produces something which is called Bite Coat on. This is more machine capable. This step has to be taken before the program can run. And then the Java developer kit includes around time environment, J R E. A rush job, a random environment and the program is executed on this runtime environment. What did we not install? Maybe you already have a job are installed on your system, but it's only a Java runtime environment, and they're also computers available or operating systems of able. There were only a Java runtime environment. J R E is available. A Java runtime environment is not enough for us. We have to install the Java develop a kid, the J. D. K. And on top off this. Develop kids, we install Net beans, Jonah Runtime environment. It's not enough for us. The JR can only run already compiled program. So if you don't load a compliant Java program, for example, out off the Internet or if you have a small device and the job our program compiled Java program is deployed on this device, this is perfect. The Java runtime environment can run this program, but it cannot be compiled out off the text FIEs so it cannot trend be translated. So this is not enough. So we have to install the stack. This is called Stack. We showed the slight before 5. 05 - First Project and First Start: Now let's get riel and create our first Java project and start our first job program to grade a project in that means you simply have to click on this folder. I can hear in the top with the little green plus. And then the project Wizards opens on Dhere. We can choose Java, which is already chosen, and Java application. That's okay, that's the first Java application project. Then I click next and I have to choose a project name and where it is saved. We can leave the location where just saved. But we can change the project name. We can say This is the Cars pro Project, for example. Then here we can choose the main class. It's a now here course project. We will leave it based way I can click finish now, and this project is created for me by the Net beans development environment. And it's already opened and here I see in my Project Explorer, the course project. The source packages are here this Java package and this is a cost project file and it's already opened here on the right side, and also some libraries are included. The J. D K libraries you don't have to care about this. This is totally okay. It's important that these of course, project file is here on this course project file also already has a main method Over here. This is the entrance point over Java application. And we can write our code here to do coat application logic. Here. We will replace this comment right now with a simple system out printing. And then we will say Hala world as a lot off programs say hello work, do you? And now we can run this program by clicking here on this little arrow on Say, run project. We can also run the program by simply clicking this arrow. I will click on it and Java is starting right now and the program is running. And here I see there is hell old in the cons, Ola, The program has run and it outputs it. The text Hello world from 6. 06 - What happened?: Wow, that was quick. We are just 50 minutes about 50 minutes in this course and you installed the net. Means I ve together with the J D. K with a driver development kit for 15 more minutes and you type in your first line off coat and you press around button and your first Java program is already running. But maybe this was a little bit too quick for you and you get lost. This is no problem in this lecture. I want toe tell you what exactly happened when we do the steps, we just did. So what happened, exactly? Well, while we created the project with net beans, a fire was created on our heart rife. And this file is called course project dot Java and this is an actual program. It's actually only a simple text fire. You can view this simple text file with any editor you like, and you can also alter this text fire. Was any editor you like? Net beans off course is much more comfortable toe edit Java projects. It has been automatically created by your net means I d e why you created the project. And for me, it is created in the fold. A higher API in the Net Beans Projects folder and there is a project full which is called course project and under the Source course project and then calls project dot Java. The fire is located. Let's ever look at this file. The's folder is already opened here on my screen and I see that it is located in this folder over here and I see that it is JAMA fire. I can simply double click it and my editor on my system is opening and here I see the Java fire. Well, this JAMA fire is located in the package course project. That means it is inside a folder which is named course project. We already see the folder a few moments ago on then this. A fire includes a class which is named cause project on the cars is for is the same name as the file and inside the class there's one static method and it's called public static void main And this static, void public main method is the main entrance method off every Java program. And inside this method, we put sir Command, which is system dot out dot printing and it should print out. Hello, World system. It's the system library and out. It's a special class in this library and we invoke the method printed on on this message. Cares for us toe print out the string we offer here to the command line. Okay, Back to our slights. We now hit the run button. What happens when we hit the run? But first of all, the Java compiler is looking for dot Java files and it finds the cause project on Java fire . And this cause project dot jar fire is a compiled by the compiler to the course project dot class file. If we look back into our folder, I simply close this now. And I navigate toe cause project and then built and classes and then cause project to cause project package. I find these cause project dot class here, and I also can open this and we see that it is a binary fire. So this is the bite coat which is executed when we run the program. This is automatically generated by for us by the net beans I d. And if we look back the net beans i d E now starts up Java virtual machine here on the right side and inside the Java virtual machine, the course protect dot class file is deployed, and then the program runs and the main method is executed. And this hello world shows up at the command line. That's what happened. That's a process. How every Java program come into execution and is executed. 7. 07 - Variables: Now let's make some use off some variables. Variables are place holders in a job, a program, and you can put different values in these variables on these variables can be written this way and on the other hand, they also can be read. I'd like to put some different variables year in my main method in the classes is the place where I can put them. I can also put them in other places. But for the first time, we only look at these main close year on. Uh, we just concentrate on this four this lecture and for the part off this course, I introduce some variables. All variables need types in Java. First off, all I have to give a variable type. For example, the Intertype is for integer, and I can put value there. For example, I create an integer and I want to put here the amount off apples I half or I choose a different name number off apples. I have to make it more clear. Then I can assign this variable value. Maybe I have five apples. I can also sign this variable later value. Then I don't need to rewrite this int I simply right number off apples I have, and then I can set it to five. Maybe, or even I can sit minor strife or some different number here. And if I want to print out this number again, if I want toe, print it out with since system out parental, I can simply add it at the end here I say Plus and then number off apples I have how the world I have plus apples. I have to write it correctly. And then I can again run this program by clicking on the green button here, and it will output. Hello, world. I have five apples. That's it, by the way, while I'm typing, you already see that sometimes it underlines it with rat line on Duh. You Maybe you know this red line from Microsoft office from Microsoft Word. It says that there's an arrow over here. We can have a look at this symbol, and it says cannot find somebody that means in you, as I typed it here is not available. I can simply press on the keyboard, the controls, pace combination, and then I get a suggesting what to adhere and the net beans development environment automatically sees that there's a variable in my coat which is called number off apples. I have I can use here, and I know I can choose one of these. I choose the top one and, uh, press injure and it automatically prints it out. I can reset this variable, maybe 27 Then first variable has been set to five. And then it has been set toe seven and off course. What's printed here when I push the green Errol here is Hello world. I have seven apples because the earlier number has bean overridden with seven. I can also use other variables. For example, I can use a double burial. The double burial is used to have value India, which is not ah, right number, but has the numbers after the point so I can at hear amount. For example, my bank account, which is 6 66 Maybe right now, Andi, I can also print it out here. I se plus and I get a new line here by simply pressing injure. It doesn't matter if inside command in Java there's a line break. It does matter if inside a string which is here, there's a line break. But if there's a line break over here in this area, it doesn't matter. And I can simply continue in the next line and I print out. I have US dollars amount plus amount. Plus, in my bank account, verily the thought. Maybe I'm a child or yeah, maybe it's also only my pocket money. Okay, then I can press the green arrow and it says I have us dollar 6 60 Side six in my bank account. The last variable type I want to introduce you. I already mentioned that is the variable type string and inside strings. I can put some text, for example. String name should be Max, for example on then I can also at this drink over here. Hello, world. The remarks, you know, or simply Maxie over here. And then it prints out these max over here. So strings are also available in the job. Our language? That's it for this lecture. And in the next lecture, we will look for if close 8. 08 - Explanation: Variables: let us deepen the last lecture and repeat the last lecture. The Last Lecture Award about variables. What are variables? Variables are actually only placeholders for values. You can define a variable, and then you can sign a value to this variable. Or you can even assign value toe the variable while defining the variable Variables are strongly typed in Java. That means that you have to specify the type off a variable first before you can use it. You definitely need a type off. The vertebral otherwise cannot define the variable, and, for example, this is made for the variable. I hear this variable. I gets an indigent type, and then we assign one toe the variable I you are allowed to reassign a variable every time in your program. Everywhere you can reassign it. It's only a placeholder, and you can put other variables in the parable. So what variables did we get to know we were introduced? Toe the int type off bearable. The in type of variable holds whole numbers. It takes up a 32 bit in memory, and it's from about two billion miners to two billion plus, and we introduced the double variable type for floating numbers. This double floating numbers type already has dollar precision. It takes 64 bit in memory on DA It's from these minus value to this plus value. It can really take up big numbers, and we introduced you to the string type, and these string type is for text strings. These air three types off the variables of very off used in Java programs. So I introduced you to this variable types first. But off course there other variable types in Java thes variable types are, for example, bite. A bite is only eight bits on its from minus one on 28 to plus 127. So if you have little numbers, you can put them into bites, and this will save you memory. But there's also a short type. It takes double off the mount off bits, takes 16 bits, and you already have picked numbers. Then there's in between. The in type I already showed you butter. There's also a long type on the long type. Take 64 bits off whole numbers and you can get really big numbers in here. So there's also a single precision floating number. Type on the the number type has a lesser, very a less amount off the values you can put in there often. He also used the bullion type the bullion type only hazard to various. You can put in there the true value and the false value, and I have to mention that often objects are assigned toe wearables in Java. Then the variable must be off the type or off the class off the object. We will deal with that later in the course. But we already have an object. A lot of things are objects in Java, the stream type is actually a class, and string is an object which is put in here. 9. 09 - If-Statements: So let's have a look at the if statements which are provided in every programming language . And of course, they are also provided in the Java programming language if statements are possibly used if we have to check some variables if they are in some numbers on weaken you thesis checks to run distinct coat, for example, and we can check the number off apples if the number off apples is one. I simply write if and then braces if number off apples and I used these development environment feature here again if number of apples is equal one and then I say in braces system out parental. Oh, it is my last one, folks. And then I set these numbers off Apple CEO 21 and I can start in this program. And then it says, Oh, it's my last one off course. If I said it, do seven back again and run my program, then this line doesn't appear this code in here isn't executed. Additionally, I can, um, just skip or leave out these braces here. If I only have one line off coat here, this is enough, and I can run this program I set here the numbers off Apple's toe one again. I can run this program and it prints. Oh, it's my last one again. Additionally, there isn't else condition. They're a kind can choose. Er the Elsa case. And here, for example, I print out system out printing. Um, I have enough apples. Yep. And, um, again, it chooses if the number off apples are one than this is printed out, otherwise basis. Print it out. And I can also leave the braces here. I run this program on. Of course, it's prints out. Oh, it's my last one body. If I set them back to seven, it prints out, uh, I have enough apples. So it's in the Els case down here. So I can also at the braces here, and I can use the mixed moat or I can at the braces here again. Andi, I can simply mix this off course. I can also have another expression in here. This is an expression, and it's it's evaluating to force or through. If it's true, it's in these parts off the if statement, and if it evaluates toe falls, then it goes into this and off course. I can use other statements, other expressions here, for example, I can check my amount of money if amount smaller than 100 for example. All I say, it's system out. Print own. I have little money. Otherwise tests, for example. Black gold toe. The rest are runs. Yeah, unde eat delicious foods there. Okay, I can run this. And, uh, it says I have little money. But if I say I have one on a 50 packs in my pocket or in my bank account, it says, Let's go to the restaurant. So I can also use the these double values here. You must be careful because off the double values you cannot check thes double both. We seize both equal signs because and the double values are sometimes around a little bit. And then it doesn't exactly match and you get strange results here. You can also use strings here. If you want to check strings with the if statement, for example, we can choose if my name on then I have to use something else. I have to use the equals method. If my name equals knocks, we cannot use these comparison or all this year we have to use equals That's object comparison in Java. And I can say if my name equals Max, say, for example, system out from special offer for for Max people. You know, Mabel, maybe is this is OK. Oh, Justin example. You know, and I pressed the wrong button on it says Special offer for Marks, people. Yeah, that's how I can use if else statements on duh. You may realize that there's a lot of power in these. If else statements, you can distinguish a lot and have Coach running on one case and coat running on the other case. So let's switch to the next lecture, and in the next lecture we will have loops. 10. 10 - Explanation: If-Statements: Maybe if statements are now clear to you Maybe not. I want to have a repetition on this time chose theoretical approach to the if statement, the if statement is a control structure. It is a structure how to guide the control flow through the program, and we can visualize control flows by using flow charts. Flow charts are simple diagrams which show up how the execution flow is running through a program, and this flow charts have different items. First of all, the flow chart has one start and one stop item, and this is shown up with the this box with rounded corner rectangle with rounded corner. Then there can be user input into the program, for example, typing in something on the keyboard and there can be user output out off the program, for example, showing something on the screen. And this is shown with this little power little crumb. The two items we want to use our this operation item. It's simply a rectangle, and the operation name is in there and we want to use this Diamont item on this diamond item is a decision. There is the expression in the diamond and if the expression is true or falls, the decision is made. So how can an if statement be shown as a flow chart? We have a simple flow chart for an if statement on this light or we want o build it up on this slide. For the beginning, there's a previous operation in this low shot. This privilege operation took place before the if statement was reached. And then there's a decision in this, if statement, a decision where we can have through or a force outcome we now hear check if the value off I is smaller than 100. If it's smaller than 100 we have true. If it's not smaller than 100 we have false. If it's smaller than 100 we have through and we go over and we execute the body off. The if statement. These are the first curly braces after the if statement, and if the body is afterwards executed, we go on with the next operation. In our program, the control flow just goes. But there's another case. There's the false case. If the decision is fools, if the outcome is false, then we go over to the body off the else state. There's the body off the else statement. This is executed and afterwards we go over to the next operation. It's important that in the false case, the body off if is not executed and in the true case, the body off else is not executed. Only one off both is executed. There's a verity off the if statement. The statement can also be shown as in this picture, The true statement. If the decision is true, the body off if is executed. But there's in missing l statement. So in the false case, it just continues to the next operation. There's nothing executed there. It just continues in the program floor. So we have a new option toe. Have a block in our program. Off this block is only one operation and we can executed or not. How can we write down if statement? There's a simple if statement on this slide. We can write it down with curly braces or we can leave out curly braces if we just have one command and we can also mix both types here On this light, we have the if statement and then in normal braces, number off apples. I have equals equals one. We already know this expression, these variants to through or two falls and depending if it's true or false. If it's true, then the first block, which is in curly, braces this system out printing. Oh, it is. My last one is executed. Otherwise, after the l's, the curly braces block system are printed and I have enough apples is executed on this light. The college races are eliminated. This is correct coat, because we only have one line off court One command this system are Brinton command. Two times we can leave this curly braces out, and we can have. We can use the if statement this way. We can also use the if statement in a mixed note here in the first part. The first block still have curly braces, but the else part off the if statement has no curled braces. This is also correct coat, and we can do this also the other way round. So what's an expression? We already mentioned that number of apples I have equals because one this is an expression . How can we build up such an expression? This expression must evaluate toe either true or force otherwise the if statement, and also other control structures cannot do anything with this expression. The expression can be built up with equality and relational operators and later eater can be built up with comparison operators if there are already through or falls values being the expression. So what are equality and relational operators? First of all, I have equality operators. In this list. There's the Equality Operator Equal sign, Equal sign on this Equality Operator means equal to if the value on the left side is equals toe the value off the right side. It's equality Operator evaluates to true, so they are both equal. The values are both equal. It's true. Otherwise it's false. Then there's thes exclamation mark equals sign operator on this exclamation mark equals sign. Operator means not equal to It is true when the left value and the right value are not equal to each other. Otherwise, it's fourth, so if they are equal to each other, it's false. Then there's this greater than the greater than or equal to the lesser than and the lesser than or equal to. These are relational operators, and they can be inserted there, and the values can be checked with this operators there also the conditional operators the ant and the or the ant is done this way and the or istan. This way we can combine all the operators together. For example, I combine it this way. I have I is smaller than 10 and the J is greater than zero and bulls off. It must be through. So everything is true. They're two pitfalls with expressions for any control structure we have in this course. The first pitiful is that the double and the float values are not the precise numbers, but they are close numbers to the numbers they should be. So because of this, you should never use the equals equals operator with double various and never use the equals equals operator with float values. Always use the relational operators like smaller equals greater equals a smaller or greater . Otherwise, it could be that you miss the precise value because the value is only close. So the left side and the right side look equal. But I actually not equal. They only close to each other. And so the equal equal signs doesn't say through it says falls. And you have a problem with your program, maybe your loop or the if statements run just over because it's always force. So be aware off these double and floaters and never used them with the equals equals operate. The second pitfall is that objects have to be compared with the equal method, which is in the object. What's the reason for this? Primitive values are compared with the normal equality and relational operators. That's totally okay. But if you use the equality operators or the relational operators for objects, you actually compare the position off the objects in memory, not the objects themselves. So if you use equals equals, if you have the same position off the object in both terrible's, then you will have through it ever wanted to. True. If you have two distinct objects which actually hold the same numbers or the same strength , we use the the equal method for strings. Then, if these strings are distinguished, they are saved in different objects. Then, even if they are the same, this equals equals, say's force. So always use the equal method for objects. This method is implemented in every class, an object on if you have more complex objects. If you implement the object yourself. If you implement the class yourself, you have to implement the method to guarantee that you can compare thes objects, which is our which come out of the class butter for classes. The good news for classes of objects which are hold off the Java R P this method equals is already implemented. So also for our string class, this message is implemented and we can compare with the equals method to string objects. 11. 11 - While Loops: So let's first have looked at a while. Loop the while loop is a loop which loops until some expression is force. So I introduced some variable here to check this bearable should be called Countdown and I said it to 10 by example. And now I create the wild and the wire loop should run on when the countdown is not zero or , um, it should run when the countdown is above zero. Yeah, that means these braces are entered when the number off the countdown is greater than zero . And here I simply want to print out to countdown. So it's counting down here. I simply pressed controls base and it's filling it up. And then there's a common mistake. If I use this wild group this way, it will never end because the countdown isn't crim ended here, and the variable always stays 10. I have toe decry meant this countdown to, uh, really countdown the countdown. And I can do this by writing countdown equals count found minus one on. Then it d Crimmins. I can also choose another option. I can also write count down minus minus. And then it also determines this is the same as the line here. So because it is, it's it's shorter down here. I I delete this line and use the other one on. Then it's Count Downing. It's counting down and I can run this program now and let's have a look at the output. And here we see it's counting down from 10 to 1, because when its ah one or when it zero here one is the last one which goes through here when countdown zero. Then it's not greater than zero, so it stops. If I say um greater then or equals then and run it again, then it countdowns upto zero so I can change this this way I can also say not equals zero. Then it's the same. It runs upto one, because when it's zero here, it doesn't get through the loop. This equals two two false and then it drops out of this loop. I can also use a while loop another way. I can remove these braces here, and then I can only have one expression in here, for example. This would also be OK. It's counting down, but it's not showing it anymore. That's the while loop you can use. So I look this way 12. 12 - Explanation: While Loops: we want to look at the while loop from the threat ical perspective to on this slight I want toe show you a flow chart off the while All the while loop starts with the previous operation and after the privilege operation is done, there is the check here it is checked If the value I is smaller than 100 If this value I is smaller than hunt 100 If this is true, then the body off the wire group is executed after the body off the while loop is executed , it returns to the check and it's again checked. If the value I is smaller than 100 b where if the value I is not smaller than 100 If this is false in the beginning, the body off the while loop is never executed. It's never reached. The decision is already false at the beginning and that means that we do not go into the wild. Also be aware that inside the body off the wire look, you have toe app update this condition this variable If I always stays smaller on 100 because you forget toe increment I for example, then it will always look through and actually your program is crushed. If the decision I a smaller than 100 is false, that means I is greater than or equal 100. If this is force, then the next operation is executed and we left the wide open again. The while up can be written without curly braces and with curly braces. If you only have one statement as in this why loop? It's okay to ride it without curly braces. This is correct. Coat. This is executing the wild. But the normal way it is that you write down the wild. Look this way. Here we have curly braces and we can have a block off coat which is executed here. There is variation off the Via loop. There is a special loop which is called Do while loop. The do I look is different from the wire up because in a while loop the condition for looping through the body off the while loop is checked before the body off the wild loop is executed and in the do I loop, this condition is checked after the body off the while loop is executed. So we have a different flow chart and I want to show you this flow chart on this slight. First of all, we have the previous operations and after the previous operation took please, we directly jump into the body off the wild, so the body off the while loop is executed. Afterwards, we have to check. We made a decision. If I smaller than 100 or if it's great, are equal 100 if it's smaller than 100. If this is true, the body off the while loop is executed again. The loop loops. If it's false, we continue to the next operation this while loop this do I loop is different from the other y look, because maybe you already realised that the body off the while loop is always executed at least once because the check is made after the while loop after the body off the wire loop . So the body off while this operation is always executed once and then we decide if it execute this again. So how does the do wire loop look like? Let's go to the next slight. The Dubai Loop can also be written with curly braces or without college braces. Here we have a coat off the do Why loop with curly braces. We have the do keyword in front, off the do while loop. And then we have the court block off the why Look here in the court broke, we detriment a variable which is named Countdown by one. And after this coat block ends, we have the wild keyword. And there we have to check the expression which is either true or falls. If we again looped through the block off the white loop, we can also write this without curly braces. Then it looks this way. If we only have one command in the block off the wire loop, we can do it this way. But this is very uncommon. And many programmers wander. Read this correctly, but this is totally correct Coat. 13. 13 - For Loop: So let's have a look at another loop. It's the for. The whole group can be written in many different ways. Um, in my case, or in our case right now, we only have simple parables. So we use it in the stomach case. It can be used in other ways. The four loop is written in the following way. We say four and then we have braces on. Then we have the body off the four loop and we're seeing these braces. I have toe fill in three parts. First the variable which is initialized. We often use E in here and then on the condition when the for loop breaks are when this condition becomes false, the four loop is over the program continuous with the next statement after the four loop, I say here E is smaller than 10 and then through the action which is taken after the for loop has run. When I have toe increment, for example, the variable e here and I say simply, e plus plus and now within the loop, I can print out this e system out print on and then of the eat, and it will print out the I simply run this program toe demonstrate. The follow up on the E is running from zero because it's in lashed initialized here with zero than it's running. Then the condition ISS checked and it's checked if, but it's incremental it here, and it runs upto nine because nine is the last number which is a smaller than 10. That's the for loop, the for loop ihsaa, for example, running this way. And I can also leave these braces here if I only have one line in here, so if I run it again, it's running the same way. 14. 14 - Explanation: For Loops: let us revisit the four loop and let us have a look at the for loop From the theoretical point, we want toe build up a flow chart for the four loop on this slight. First of all, we have the four loop here we have the four key word and after the for keyword, there are braises and inside the braces there are three parts. First the initialization off the variable I in this case Then the variable eyes checked. If it's smaller than 100 afterwards in the third part the variable I is incriminated by one . And within the curly braces there is the body off the follow up on the body off the for loop is executed If I is still smaller than 100 So how does the flow chart look like? We first start with the previous operation After the previous operation, we have the first part in these braces Initialized ization off I This is exactly this part here After we had this part after I is initialized, we go to our decision and it is checked if I is smaller than 100 this is exactly this part in our program And if I a smaller than 100 If this is true, then the body off the for loop is executed after the body off before loop is executed. Exactly After the body is executed, the variable I is implemented. This is this part off the follow up and the check is don again. If the the check is full, then we go to the next operation. There are different ways how to write down a follow up. First we want to do it the traditional way. The traditional way is that we have a variable I, for example, which is initialized. And then I checked, for example, against area length and then after the body was executed after we had access to our A I then this I is incriminated. So this is the traditional way. The traditional way has one alternative. We can also use it Traitor in the follow up. Then first, the traitor is initialized in the initialization part Off the follow up in the Czech part Off the for loop, it's called The method has next on the a traitor and the last part off the for loop had a we miss your this part is done when we call it aerator dot Next, which is here in the body off the four group. This is the traditional way we can iterated over a collection this way. Or just iterating often area by incremental variable in the fall of which, for example, is I hear there's also a variation off the for loop. It's the four each group and it looks this way. It looks very similar toe the traditional way. But here we have not three parts in the header off the followed, but only two parts. The right part which is here collection. It's the most important part. This is the collection we want toe it rate over and on the left side. We see an item off the collection so this for each loop in the background, it creates the IT aerator over the collection and then each item in the collection is inserted within these item variable, and we can access the item bearable in the body off the for each loop. This is an alternative way, and we can write the four loop much shorter, and it's ah much more readable again. As all other statements, four loops are possible with and without curly braces. Normally you have this four loop with curly braces. But if there is only one command inside the body off the for loop like it is here, we can also write this fall of without curly braces. So no, a question comes up for us. When should we use the while loop and when should reuse the follow up? Thes two loops look very similar. They're both loops and when to choose the one and when to choose the other two. Have this question answered. We can have look at the Weir Group and the four loop 1st 1st let's have a look at the wire loop again. We have to be aware in the while loop that we have to initialize the counting variable outside the wire loop by ourselves. So the while loop doesn't initialize the variable. If we do not initialize it outside, it's no problem. The compiler will tell us that we didn't initialized it and we can initialize it later, but we have to increment our counter variable also ourself. That means if we do not increment it within our while up we got a critical programming error and we will find out this program arrow only when the while loop runs throwing program execution. In this case, the cool program crashes. It stays forever in a wire loop, and it looks like the computer is crashed. This is a problematic programming mistake, and we have to be aware of this. We can do this mistake, and it's a critical in production environment if we miss to run the wire loop during our test cases. So the while loop can be, on the other hand, used. If we want to be much adoptable if we want toe, have a loop where we really do not know when the loop will and and at the beginning, we do not know how many times we should look to throw the rope, you can say to the wild hope from inside. Tell the wild from the body off the wild up inside when it should stop. So in cases where you do not know in advance how many times you have to run the group, you should use a while loop. Even it is a problem with initialization and the problem that you can miss out incremental the counter terrible. So the four loop is different, it's much more comfortable. And because thes three parts the initialization, the check and the increment off the counter terrible. It's all in the header off the follow up programming arrows are eliminated and it's even much better with the for each loop there. You don't have to care about incremental. Your item is just presented to you inside the follow up. If you iterated, for example, over collection, so you use the for loop. If you know in advanced how many times you have to loop through the loop, you know, in advanced how many times you have to look through that loop when you, for example, loop over an area because the number off items in the area are already known or, if you look all the collection, the for each loop, nose and advanced. How many items are in the collection? 15. 15 - Switch Statement: Let's have a look at the last control flow statement. We want to have a look here. It's the switch treatment. The if statement has a two cases to outcome in cases, one is then case. And then there's also the else case. The switch statement can have more than want two cases to outcome in cases toe demonstrate . This which statement? I introduced a new variable here. Maybe it's called number. And then I open us. Which statement? Um, number and it chance braces to opening and closing braces here. And then within these switch statement, I write case one is the number equals one. Then I want toe right out. Uh, something I have one on, Um, in case it's too. Then I want to write out. I have hair under in case free. I want to write out I half a triple. No, I couldn't write this. Yeah, And in the default case. Yeah, I can simply right out. Um, I have for a yeah number. No. In Dasa problem with this switch statement. Is this statement on Lee does not only print out, I have one, but it runs through all these cases. This is different from the if statement on the ends at the bottom. So I have to internews another statement here. I have to break the if the switch statement here and I simply right break in here So it breaks after it has printed out. I have one and I have toe at this to every line except the last. But because it looks better, I also added in the last line, No, I can try this switch statement. I run the program and it says I have one. If I put in the tool as number here, it's where run I have appear. If I put in three off course, it runs on it says I have triple and I put in 55. Then it says I have 55. That's the switch statement. It goes through the cases in here and if it matches the one case, it goes in here. And don't forget the break. You know, if you forget the break, it will print out. I have one and I have a pair. I can also demonstrate that if I, uh, put in one year, then it prints out. Have one. I have a pair. It simply runs through here. So better half this break here to quit the switch statement from running through here. Okay, that's it. And in the next lecture, I will deal with assignments. We had some little assignments year, for example, this one and this countdown assignment. But we want toe have a deeper look in tow. Simon's on how to do some meth was Java. 16. 16 - Explanation: Switch statements: So let's also draw a flow chart diagram off the switch statement. The switch statement starts again with the previous operation before the switch statement, and then it goes into the switch part. Now in the switch part, there is a decision First, if these case one. If I, for example, equals one and if this is the case, then the operation one is executed and after that remember there is a break. So if I equals one x force, there's the next case. I equals two, for example. And if this is true, then the operation to takes place. And after that a break then if Operation One break an operation to break. If this are done, then the flow chart continues with the next operation after the switch statement. But they can also be a D. Ford statement. We know if the case to is again force, other cases can follow. But if there's no more case than there can be a default operation and after this default operation, we also do a break because it's very important that we do not miss the brakes in Operation One and two here after the default operation. Also the next operation takes place. So let us so let us have a look at the switch statement when in Operation One and in operation to or in one off these operations. The break statement is missing. The break statement is very important. Many programmers forget this break statement and if we forget this this to take place the operation one is executed in case I equals one. And after that it's no break and it continues with operation to It also goes into operation to when I was too. And after operation to the brake is also missing. Then it goes toe default operation. It is normally not intended that it is executed this way. So do not forget the brakes statement. It's a common mistake. 17. 17 - Assignments and Operators: also assignments and operators very essential for programming languages. We will do some math with Java right now. You can also do the same with all other programming languages. I introduce a new variable, and I say it's called E On. I signed one to it. Andi, I also want to print out this variable saying e is okay on Ben. If I press this green button here, it says he it's a printed out. That way I can do some math over here Now, for example, I can see, say, one plus one. Yeah, and then it prints off course out. If Prince is too, that's normal. Yep. I can also use some other variables year in my assignment. In my calculation, for example, I introduce a new terrible cold and and I say and it's five and then I can hear C e equals one plus n and I have toe use a semicolon at the end here on. Then I can click run, and it's as e six because five plus one is six or one plus 51 plus and is six okay? I can also do some other stuff in here like I can say Ah, one minus one. Then it prints out zero off course. Or I can use division, for example. Four divided by two. And it prints out he is, too, because four divided by two is two. When I say five, divided by two, it the prints out again to. That's because this division is only the full value division on it ignores. The remainder knows the remainder want. If I want to get the remainder, I have toe use the percentage sign. And if I run it again, then it says it's one because the remainder five divided by two is what? Okay, I can also use multiplication. Um, five times two is 10 off course on. Uh, I, uh, can use it this way. Then I have a look at the double values. Double Varios work. Exactly the same. Except the thing with the remainder. If I divide five by two, then, um, it's really divided by two on 2.5 will be the result. This is not correct here because this is still the into to division. I have to use one double value, so these to various are converted to double values. So to use one double value. I say 2.0, I divide by 2.0 and then I can have this 2.5 in this B and I also printed out here at the bottom Replace E by D On it says the is 2.5 here at the bottom. No, I can do some concatenation off strings. With operators off course, we I can say string s for example. He's one plus empty space to and then I can also print out this string. Actually, string concatenation was different. Type off variables are done here also has also done here. So it says s is one space toe Asir this'll string is a concatenation. That's ah normal operations. I can also use the short versions so I can increment e for example, in deep, I can write e plus plus or I can also write e minus miners now than its secret meant again I can also at some other value toe e by writing e plus equals five, for example than five incremental on E. Or I can also use the other mathematical operations here for this culinary operator which is being here. Yeah, that's basically what has to be teached about Thea operations and the assignments in Java. You can do operations and you can sign the results off these operations toe a variable like this. 18. 18 - Explanation: Assignments and Operators: let us have a quick overview over assignments and operators. First assignments. You can assign any variable, any value with a simple equal sign. The variable is on the left side, and the value is on the right side. The only thing which must be true is that the variable is off type off the value. For example. In this case, I equals 11 is assigned to I, and I must be on into variable. Otherwise, the compiler will tell you that the types mismatch so you can use normal math operators for numbers and for floating numbers. And for indigent members with plus minus multiply and divide, you can override the standard mathematical order with braces. You can do simple mathematics with this. For example, five plus one embraces times 2 12 but five plus one times two is seven. Because the multiplication is before some for floating numbers, the division operator just works like normal. The number is divided, and then you get a divided number divided result, and this is also a floating number for whole numbers, which are in bytes in shorts and inch and long variables. In Java, the division operator means that only the whole number part is given back from the division . You can get the remainder by using the percentage sign then for strength. The plus operator is overloaded for strength. The plus operator means that not the strings are added. But the strings are khunkitti nated and for non string well yells, which are added with a plus operator, two strings, it means that the non string value is automatically converted to a string. For example, this value off I is and then Plus I means that the plus I or that the eye this interject value is converted to a string and is concurred in a tid to the string value off I. If so, you can print out or bring integer values in strings this way. 19. 19 - Methods: So let's go onwards to Java methods. Each class in a job. A project in a Java program can have methods. Methods are concept off all modern programming languages and in other programming languages . These methods are, for example, called functions, or this message are also called procedures In Jeolla. Methods are cold methods and I'd like toe injured use a method in our short program. Here I scroll toe the top toe insert the method. I can also insert the method at the bottom. Actually, we already have a method in this program is called Main here, but I want to produce a new method. I want toe enter a new method and I say public static because it should be aesthetic method . We are in aesthetic mode right now. Then I have toe enter a return value off the method. It's string here and I have to enter a name My methods on I have to past some pyramid is also can has no perimeters buy it. I want toe pass some perimeters, for example palm And, uh, the next one is part um X, for example. Then I have to create a body and my beans development environment wants me here that the re stern statement It's missing. So I have to return some string here if I don't want to return something. I used this void as it is in here. But here I have to return a string. And I can, for example, return examples right now. Yeah, and that's already a method. This method is also mentioned year in the navigator, as you see in. But for now, this method is not ready. I don't want to use it right now. Here. I can also switch the methods here. I can jumped with the main method here and back toe my method. Yeah, that's navigation within one class. So within these sub program was in these method, I can do stuff with the perimeters which are passed here, and these sub programs somehow isolated from the rest off the system. So it's a good place toe and do some encapsulated calculations. Some algorithm which is separated from the meaning program which also can be invoked more than one time. And you can do this in methods very quickly and it's ah very comfortable too. Usis methods. Um, I do this here. I, uh, introduce a new string which is called S and I simply want toe create string in this method on string says out off my method Popham he's problem And then uh uh, Possum X is X. That's my concatenation off the string And I also want to return. This drink s here. I can also write this in short by example. For example, if I simply return this concatenation did string quickly on I have toe write it this way So it's OK. So how to call this method? We can go back to our main program and here I can now called the method by using my method and I press controls face on the environment On my net beans, the development environment Come auto completes this and says I have to pass a Param and the paramedics I want to pass Parham one and Param extra B 2.5, for example. And then I called my method. I don't have toe use the return value off my method in the calling program. The return value if we look back to my method is string value. But I don't have to use it down him. I can simply skip it, but I want to use it. And I introduce a new variable which is called, for example, x me out. And after that I can system out print on this X string and it's printed out. I run the program to show you how it's printed out on Bond. This string comes out off my method and it simply prints out the paramyxovirus. Here. We missed space here. I will add quickly at a space here at the top. So it's printed out here. Correct. Okay, that's it. I can also call this method multiple times and, for example, with 3.5 and use stream Absalon Onda, Then string that I enter three here on Ben. I can simply print this out here and maybe you are, you know, sieves When I run this program, it prints out a lot here A to bottom man. You see, maybe you already realize how convenient, how good methods are, how good it is. Toe separates parts off your programs in soup program so you can run them by just calling them here. 20. 20 - Explanation: Methods and their Invocation: Let's have a look at methods in this lecture. Methods are procedures are functions are sir parts off a program sub programmes off A program on these methods can be invoked multiple times in a program we encapsulate Ah, function lt in a program which can be reused in many places. So on this night there's already a method and this is a job, a method This method has first off all the name and this name here is my method and then it got a para metalist It got a pyramid A list with the type off the paramedics Here we have two Pyramid is which must be provided to the method first on inter para meter on, then a double para meter, then a method has a return value A return type here. In this case, the value off the type string is Richard and then a method is IRA static or it's not static . If aesthetic aesthetic must be in the front off the method written and a method is, for example, public. A modifier must be given this first line. This is called The method had a or the method signature and then the last part off the matter is called the Method Body. The method body is the place where commands are placed, which are executed when the method is caught. Let us have a look at her rules from efforts. Methods are first static or non static. Aesthetic method can be called out off a static program part or an object program part. So it doesn't matter where the static method is called. But if you have a non static method, this can only be called out off object part off the program. So the object part is non static and a non static method can only be called out off the non static part within the body off the method you can access the given para meters. The pyramid is which are in the list off the header off the signature off the method You have access to these para Mages. You don't have access to these permitted outside the method under the name off these para meters in the body off the method, you have to give back the value off the type which is declared in the hell. You return this value with the keyword return. If you do not want to return a value from the method, you have to use a void as return type in the head. You can off course coal methods off course methods are there to be called on. Method is simply called by just invoking its name and giving the tear amita list. So the values must be in the para meters. Here, one int and one double value and a method gives back value. You can accept this value or you can ignore it in the first part. Off this light, the return value is ignored. The string is not saved, but in the second part, off this light, the string it's written toe the variable yes. 21. 21 - Classes and Objects of Classes: Now let us have a look at another concept off job. The concept is classes. There are classes in Java and you can incense e eight, these classes and then they become objects. But first we need a class. How to create a new class with the net beans. I d you simply click on this course project. This is our package. We can have other packages here, but we only have one package. We can create a new class bile saying New on then Java class and then a wizard pops up and we can give the class the name I say my class Onda. We can leave the rest untouched and I click finish and then this new class is created This new class ISS year, it says it's public. It's a plot public class and there is a world class toe. Identify that these is in close. And within this class we can just create methods as we created into the course project class. Remember when I click here? I created this method in this static. My method and I also can create a method in the my class. Right now let's create it. I can say public static. And then it's my second message. Um, this method returns nothing and gets nothing. It just prints out, system out parental. I'm in my second method, and now I can call this method in this class in the course project class, I simply go to the end off the class. And then I say my class and my second method, I can invoke it. Year like this, I click execute and then I'm in. My second method is printed here. I'm in this method. I enter into these methods and this method is executed. The next thing is that this method is aesthetic. Also the method in course, project or aesthetic. Remember, we put static in here and also the stand up main method. The entrance point off our off our application. This method is also static, but we can change this. We can say it's not static. We implement a method which is called my third method, and it's also simply prints out system out printed on. I'm in my thought method, and now we can try to invoke this method into our program. We can try this by using my Kloss and then you see, there's No. My third method here. I can try to type my third method here on then. The EE says that this is not possible. It says non static months of my third metal cannot be referenced from a static context. That's totally clear on because it's not static. It cannot be involved this way. We first have to create an object out of my class on. I do this by assigning this object toe. A local variable, like all other variables before in this parable, isn't from type inch or double or string. But it's off the type my class now and I say new my class and then the constructor off this class involved is invoked its instance c ated. And now I have my class in this bearable lower my class, and now I can invoke the my third method on this lower my class variable on. This is possible and I run the program and it says, I'm in my third method. Okay, that is how to create classes. And we already created an object off this class, and we invoked method on the's object off the class 22. 22 - Inheritance: Java is an object oriented programming language and O p What us? Let me. Well, in the last lecture, we already saw that Java has classes and the Java has objects. Objects are created all of classes. But that's not all for object oriented programming language, object order programming languages also support inheritance. Inheritance means that a class is inherited by another class. So what does its practical mean? This means that all methods off the class are copied in the second class. And also all wearables will come back to a variables later also copied in the other class except methods which are marked with the private modifier or variables which are marked with a private moment modifier. But we will also come back to this later. So what does it mean in practice? Let's create a class which is inheriting the my class. So simply click my course project and say Java class and and we se second class here This is the class which inherits the other class. And then we say finish and this class is created. But now we say toe this class that it extends and this is a job. A key works My cloths and that it's now we have an inheritance hierarchy. My class is the upper class and second class is the lower class, the client class which is inheriting all methods and variables from my class. Let's ever look at our course project class and now we can create in the East second class here and we can also have a different veil Variable se second class here and then we can inherit the method can be invoked the method on second class and we can run this program and it sets. I'm in my third method. Remember that this my third method is not in second class. It's in my class. So this method, my third method here this was copied toe the second class here. There's no method. Nothing is written here. This is automatically copied from here to the second class 23. 23 - Class Variables: So let's go to class parables as mentioned in the last lecture. Well, class variables are simply variables which are in a class they're not in a method. These are method variables or local variables. These variables are inside a class, so I can have a class bearable here by simply saying public hint and then class variable on this variable, which is named class bearable like now I can also name it. Different is outside a method in the class. And so it becomes a class where I have to mention here in that the methods off a class when an object is instant stated these methods are not copied. All objects used the same methods. They stay in the class. But the class parables our carpet. So every object which is instant ated in the Java context. Every object has its own bunch off class barrels. So they don't get mixed up between each other and each object becomes its own or has then after that, each object has its own identity. So here we have thes class bearable and we want toe get and we want to set this class variable. We can simply access thes class Maribel out off this class, for example. Rewrite public in in test to be returned and then get class Barry able. And then we can return this class. Very. That's it. We can also, uh, use this without this. You know, this also returns the class variable. This is a short writing off this. We can also set the class terrible, and we put in some value here, and then we can set this class variable was valley Okay, so we can use a class parable. And now we can go into our course project. And here we can say toe the second class set class bearable. I also I always used the short cuts which net beans allow me to use here. I simply place control space. And then these short cuts are used because or I can choose out off the list. And then I pressed Enter. If I have the right item in list under the course of and here, I can now say I want toe set the class variable 10 and later I can read out the class bearable, maybe system out, print on in a system are printed on class bar is and then I say, Second class, I directly invoked the second class, and then I used to get class horrible, and it's pointing me out. These classroom, this class variable stays in these second class for a while, and then it's printed out. I run the program on it says Class Far is 10. It's placed here with the getter and with a Ceta and red with the gator. 24. 24 - Modifiers: So in the last lecture, let's come to modify us. What are modifiers? Maybe you already wanted why I always wrote here in the classes public, public, public and classes public and my second and my third method is public. And also the class variable is public over here. Well, that's a modifier. And there are four modifiers in Java on and Thies is a public modifier. That means that everybody can access this parable. I can demonstrate this by going to my course project and here I can output this variable, for example. I say direct access on then in second class I want to get these class bearable and this is possible. I clothe trick on the green arrow and direct access 10 is written in the console. Well, I can also modify this class fare over here. Maybe I said it toe 11 on this is also possible. It says direct access left, But maybe I don't want that. I wrote this getter and this center over here and I want to limit the access to this bearable through this getter and said, Maybe I want to program some coat within my center which says, if fell you greater than 10. Then return. Yeah. So various greater than 10 unaltered. Except well, we can change that. We can change the access of by changing the modifier. And I say private. And now I see in the course project, I cannot access these bearable directly. I have to use the getters and centers. And for that I invoke second class set class bearable toe 11. I cannot do this anymore. So I common this out for this time on. Then I also cannot directly access a terrible I after you this coat again on, uh, I run this coat on. It says class bar is 10 again because this change is rejected by the set over here because of value is greater than 10. That's the idea. Off modifiers. And by the way, if you have a look at this class, this has now the interface off Java bean. This is called the Java Bean. It's a simple class and if has local variables which are private, and these variables are accessible by getters. The getter is written in Camel case writing. That means the first letter. The G here is small, and then every part begins with a capital letter. This class parts and this bearable part here, and it has a set of. And the centre also begins with a small letter and has, for every part capital letters. It's also written in Camel case writing. Well, it's possible that if you have a Boolean variable, Boolean variables out off the scope off this course half another course or a book for reading about bushel boudin parables for bullion variables. It's possible toe use instead. Get used ese instead. Kit, so you can see is class unbearable. Well, this is a Java bean. Let's everything about the job of being on. This is an interface off the travel being on. You know, you even learned water, Chava Penis. Well, now there are other modifiers. There's a protected modifier. We can change something here to have it protected. I don't want to do that. Protect. It means that this thesis class or thesis bearable off. This method is accessible only from the inheritance hierarchy and package where this class is in and there's a non modifier. That means that this part is only accessible from the package 25. 25 - Explanation: Classes: let us repeat and summarize what we have learned in this part. We have learned a lot about classes and objects. What is a class? A class is like a template for object, and the class consists out off a name and it consists out off class variables on it consists out off metals and you can instance e eight a class by using the new K. What Andi then objects are instance, seated from a class. The class is the template and we copy the content off the class to an object, for example, to object A in the upper right corner and this object a has its own object. Datar A. These objects data a east in the class variables. The class variables are copied there and then it has the methods off the class. Also, there's object be in the lower right corner. It has its own object data be and also objects see an object D on the left side have its own object daters see and object data D. But all the methods are copied and you can instantly ate a class multiple times. You're free toe incense It class 101,000 and even more times. This is the relationship between classes and objects. We also talked about inheritance here on this light, we have a super class and this super class is inherited by a subclass. This is shown by this diagram. What does inheritance mean? Inheritance mean that the class parables and the methods are copied to the substance so that subclass also has every class, variable and every method off the super class at the beginning. But the methods in subclass can be overridden, they can be really find. And then there's a new method with another content in the subclass, Then the super class and also new variables and new methods can be introduced in the subclass. We also talked about Java beans. What is a job? Being a Java bean is simply a Java class, a Java class which has specific rules to be fulfilled, which are these rules? First off, all Java bean must implement an interface which is named civilize ball. We didn't work with interfaces in this course, but you can think often interface as in the class, where only method six inches are given and implementing sub classes must implement all these methods and the Ciruli visible interface is only a marker in the face. It marks that this class is still I Zobel, that it can be written out as in byte stream to somewhere. So next we have these getters and setters we have for every variable in the class we had. We have to have a get variable and set variable. Or if it's a boolean variable, we have to use its bullion and set bullion. We have to have this mess. It's in the class. Then there is a permit. Tillis, Constructor, We didn't talk about constructors in this course butter, you are safe. A constructor para middle s constructor is automatically added toe every class if there's no constructor defined. So every off our classes has a constructor. We also talked about modifiers modifiers modify the visibility off a class, the visibility off a class variable or the visibility off the method. So what different modifiers are available? First of all, there's the public money fire. The public modifier means that this item can be accessed from everywhere in the program. There's no access restrictions. Then there's the protected modifier on the protective modifier means that this variable or this class or this message can be accessed out off the package or the class hierarchy. For example, if a subclass is a inheriting super class, all protected variables which are in the super class can be accessed because they are protected. And then there is the non modifier. It's not written out. It's a default at this means this item is visible to the package and not something out the package. And then there's the private modifier on the private modifier means that it can be only access out off the class. It's health. Every other class outside cannot see these available this method or even class and if totally private. 26. 26 - Where to go from here?: Congratulations. This is last video. You are at the ant off this course about the fundamentals off the Java programming language . Thank you for taking this course. And now you have a glimpse overview over the Java programming language. Off course. You're not an expert from this position. From this point, you need further development. You need to learn some more. There are a lot off more concepts in the Java programming language than presented here. You can have a look at this platform and you can maybe have some other courses on. Learn some more about Java programming language. You are invited to do so. Also, there's a lot off information about Java available in your book store. You can order a little books about a Java programming language and last but not least, you can also visit the website we visited at the beginning off the course thes Orica dot CEO and website. This is a creator off the Java pouring language right now on. Do they have a lot off tutorials there? They have a lot off information about the Java programming language there, and you can just tune in and read some more and get a really expert in the journal programming language. I hope you like learning the Java programming language. And I wish you the best. I wish you to become a Java expert, and I wish you also to finish your task. Maybe you booked this course because you need to finish some programming tasks, some programming exercise. And I hope so that you can do this with this course. Thank you again and good bye.