Java Programming: Your Guide to Beginner Java Code | Matthew Dewey | Skillshare

Java Programming: Your Guide to Beginner Java Code

Matthew Dewey, Writer, Writing Tutor

Java Programming: Your Guide to Beginner Java Code

Matthew Dewey, Writer, Writing Tutor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
65 Lessons (4h 34m)
    • 1. Introduction to Java Programming: Your Guide to Beginner Java Code

      1:27
    • 2. Downloading and Installing Your IDE

      3:10
    • 3. Your First Line of Code

      5:52
    • 4. String and Integer Variables

      5:18
    • 5. Mathematics with Integer Variables

      4:50
    • 6. The If Statement

      4:45
    • 7. And, Or and Nested If Statements

      7:58
    • 8. The While Loop

      5:41
    • 9. The For Loop

      5:42
    • 10. User Input through Input Dialogs

      5:38
    • 11. String and Integer Parsing

      5:11
    • 12. Char Variable and Parsing

      4:39
    • 13. Double Variable and Parsing

      6:43
    • 14. 1st Project Discussion

      2:05
    • 15. 1st Project Answer

      6:59
    • 16. Introduction to Advanced Programming

      1:18
    • 17. The toUpperCase Method

      3:01
    • 18. The toLowerCase Method

      4:16
    • 19. The isLetter Method and Boolean Variables

      5:14
    • 20. The isDigit Method

      2:53
    • 21. The isWhitespace Method

      3:33
    • 22. The length Method

      5:51
    • 23. The compareTo Method

      4:58
    • 24. 2nd Project Discussion

      1:54
    • 25. 2nd Project Answer

      12:24
    • 26. Introduction to Section 2 of Advanced Programming

      1:03
    • 27. The Substring Method

      2:14
    • 28. Substring Method Practice

      4:34
    • 29. Introduction to the indexOf Method

      2:32
    • 30. indexOf Practice

      4:15
    • 31. 3rd Project Discussion

      1:36
    • 32. 3rd Project Answer

      7:21
    • 33. Conclusion to Section 2

      1:00
    • 34. Introduction to Section 3

      1:35
    • 35. The Scanner

      3:37
    • 36. Scanner Practice

      6:05
    • 37. Delimiters and Basic Error

      5:15
    • 38. File Reading Introduction

      2:20
    • 39. File Reading Preparation

      1:59
    • 40. File Reading Practice

      6:05
    • 41. PrintWriter Introduction

      2:30
    • 42. PrintWriter Practice

      5:41
    • 43. The Try and Catch Statement

      3:22
    • 44. 4th Project Discussion

      2:03
    • 45. 4th Project Answer

      8:20
    • 46. Conclusion to Section 3

      1:34
    • 47. Introduction to Section 4

      1:31
    • 48. Arrays Introduction

      2:52
    • 49. One-Dimensional Array Practice

      6:33
    • 50. Two-Dimensional Array Practice

      4:39
    • 51. Split Method Introduction

      2:02
    • 52. Split Method Practice

      4:11
    • 53. 5th Project Discussion

      1:12
    • 54. 6th Project Answer

      5:43
    • 55. Conclusion to Section 4

      1:20
    • 56. Introduction to Section 5 | OOP | Object Oriented Programming

      1:34
    • 57. Classes and Methods Introduction

      2:42
    • 58. Class Creation and the Void Method

      4:31
    • 59. The Typed Method

      5:23
    • 60. Private Variables

      3:51
    • 61. Making A Scanner Method

      3:41
    • 62. OOP Practice

      9:32
    • 63. Final Project Discussion

      2:18
    • 64. Final Project Answer

      12:13
    • 65. Conclusion to Java Programming: Your Guide to Beginner Java Code

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

174

Students

1

Project

About This Class

Hello programmers and welcome to the first step towards becoming a Java programmer!

My name is Matthew Dewey. I am an experienced programmer, having received several certificates on programming in my formal education as well as taught several programming languages to tens-of-thousands of students. My goal is to provide you, the budding programmer, the knowledge you need on programming in an easy and fun manner. In this course, I do just that and with one of the most useful IDEs coupled with the Java programming language.

97c154fc.png

Java, a wonderfully simple programming language that has encouraged many programmers to pursue careers involving Java over any other language. Of course, it goes without saying that Java is an excellent language, but do you know what is required of you to start programming Java?

As with any programming language it is important you understand the fundamentals and that is exactly what I teach you in this course.

What you will do in this course:

  • Install your IDE

  • Establish fundamental code

  • Create and use variables

  • Retrieve user input

  • Process simple data

  • Learn Advanced Java Methods

  • Learn Data Collection

  • Practice Data Processing and Storage

  • Learn Data Extraction

  • Practice Data Scanning

  • Practice OOP, Object Orientated Programming

  • and BONUS tips and tricks!


What about Eclipse? A popular, widely used IDE that many large applications have been created over the years. Do you know how to use it to its full potential? Well, in this course we will go through several lessons that will help you get comfortable with the IDE as well as more adept at program creation.

Go no further if you're looking for the course that will guide you into the world of programming! With my course, I can guarantee that the knowledge you learn will help you get a head-start in Java programming. I hope you enjoy the course and it helps you on your way into the world of programming!

"Programming is a form of art. It is logical creativity!"

Meet Your Teacher

Teacher Profile Image

Matthew Dewey

Writer, Writing Tutor

Teacher

I have been writing and teaching for years, helping tens-of-thousands of students achieve their goals, be it completing their novel or publishing their work. Having written several novels, non-fiction books, hundreds of short stories and articles, I have studied and put into practice the best methods for writing effectively and efficiently.

In addition to writing, I am also a programmer and artist, teaching what I know on the subject and helping those interested get a headstart.

If you want to write a novel, a story that has been on your mind and not on paper for too long, my courses will not only help you start, but I will be there as well. Any work you submit, I will happily read, review. If you need professional advice or a friendly opinion, I will be there for both.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. Introduction to Java Programming: Your Guide to Beginner Java Code: Hello and welcome to your Java masterclass with Eclipse. My name is Matthew Dewey, lead programming instructor at programming tutt dot com. I have told Java programming for five years and studied for longer than that. In my experience, Job is an excellent program language to work with. Not only that, but is one of the base programming languages for beginners. If you want to start learning java, this is the course for you. The first section of the master classes, comprised of basic lectures that I help you master the fundamentals of Java programming. The next five sections of the course are advanced and 00 P studies well and more advanced mittens and functions eventually moving onto object orientated programming. 00 P is one of the essential skills off any programmer with O. P. You can create your own classes and objects, which can be re used to your advantage. If you want to excel at programming and work effectively, you will need O P that concludes this introduction. In the next video, we'll be downloading and installing RD Eclipse 2. Downloading and Installing Your IDE: Hello and welcome to your job programming course with Eclipse. And in this video, I'm going to show you how to download and install Eclipse. First, go to your Google search browser and top in the final down go to clip startle dollars. It should appear first on your browser. You'll be then presented with the Eclipse Start or website and next year needed Dollard Eclipse Oxygen, which is right here down at the 64. But you will then be presented of the screen You're there. Click on the dollar button, which will download the installation file, will then be presented with this thank you scream. And as you could see in the butt of Ghana, installation file is down already. Once it has been downloaded, you'll be presented with this fire eclipse inst 1 64 Don't eggs were installed. Double click on this file. Click right it presented with a box asking for administration access. You will then see the eclipse installer loading. Now. The Eclipse installer provides if many options well, of course years the Eclipse R E for Java developers. We countries where the installation is and of course, whether to have a desktop icon or starting entry is in click install. Once it isn't stored, you should be presented with this icon Eclipse Java oxygen. Who would double click on this icon and now toe Ask you if you want to run your workspace. The workspace is the idea that you're gonna be using eclipse workspace, otherwise known as Eclipse 10 or Javi clips. It has many names, but it is a lot the same. Rt eighth. You can click this box to use this as your default and do not ask again. I like to leave options open. So since it's a really selected Arkalyk launch, it may update. And now Eclipse workspace has loaded. Before this video ends, I'm gonna now show you how to change the theme. As you can see, the no more theme is quite brought and jarring on the IRS to change it. Go to window, go to preferences, go to general good your appearance and then you'll have a ball. You know that's his theme. Not, And I'm gonna change that to a dog. I think the problem on close it's easier to look at and therefore much easier to program for long periods of tough and that concludes this lesson in the next video, I'll show you how to create a project and Roger First line of code. 3. Your First Line of Code: Hello and welcome to your Java programming course with Eclipse. And in this video, I'm going to show you how to rot your first line of code. Before we begin, you need to start your Eclipse Work space program, and I'm gonna show you how to create a Java project. Months you have opened up your program. There are three ways you can create a project. You can go to file new and select Java Project. Or it can click on this law are kind of a year new and select Java Java project. Or you can right click on package Explorer, click New Job A project and it will take you to the same box. Now let's give our project in name. I'm gonna call it first, seen as it is our first program and we then click finish. Now that we have created our project, we click on the arrow here and we right click on the SRC folder. We click new and we add in a Java class and you represented with this box again I'm gonna give it the name first seniors are first program, and I'm gonna check the box that says public static void main string hogs Because we're going to need this. It automatically generates special brackets. We're gonna place our code. You can? Of course. Right. This could. But for now, I'm gonna just have it Auto generated for us and that's all reeling. Click finish. You should be now presented with code that looks like this. First you have the land package first, which refers to the package and witch. This program is contained. Our first start Java file is contained in the first package. As you could see it as the package, Alarcon hints where it belongs. Next, we have the public class first. This is where all the code contained within the first dot Java program is contained. Next, we have the public static void Main. This is where the main code of our program is gonna be located. And this is what runs our code. We need around thes following lands. If we want to create a execute herbal application meaning we need to have code years, but we don't have it in the right place. It won't run. It's sort of like having a car with gas in it, but no engine. This is our engine and Now we just need to add feel ill code to add code. Click after the land. It says to do order generated method stub, click, enter. And this is where we're gonna be writing our coat, as you know, just automatically Indians our lands so that where they are organized without further ado, let's write our first line of code system capital is you'll find that the case is also very important in programming dot out as you can see, boxes appear as are at this is giving him so asking where all code is leading. For example, it is given this one of a year the Prince stream system, and it tells us about the line of code. It tells us what it looks like and so on. But let's continue writing and finish this a lot of good dot Print hell in full on brackets . And as you could see, it automatically generated some of the code of really, But I'm just going to close brackets. Yeah, I'm gonna add double quotations inside. Inside those double quotations I'm gonna top in Hello? Well, and our clothes of his semi colon. Now, let me explain what this does before our run the code system. Our front line is the most common way to output. Daughter. As you can see, it's telling the system to out as an output, and the kind of output it's looking for is a print lan, in other words, little Prince Ellen and then enter afterwards to start to Newland. But for now, watch, Is it printing? It is printing what is contained within the brackets. In this case, it is Hello world, which is encapsulated in double quotations. So to run the Kurt, we can go to this our kind of a year, the green play button and press it. And as you could see in our consul output box, it has printed the words Hello World. You may be asked to build your program before running in this box chick that always do this option, and it will automatically build a program and run it, because this can be very tears from Tom to Tom when you trying to run your program. But it's running previous bills. This way you can see exactly what your code has done once you have made changes. So if I were to add in other words, hello world comma. How ah Yew question look, and I run the program but automatically rebuilds a program and then runs it. So, as you can see, it has the new words added already, and that is your first line of code. The most common one used in all programming is known as the Hello World Code. So congratulations you have taken your first step into the world of programming. And that concludes this lesson. In the next video, we'll be discussing string and integer variables. 4. String and Integer Variables: Hello and welcome to your basic Java course with Eclipse. And in this listen, I'm gonna teach you about string and indigent variables. First, let's start by creating a new project quickly. New Java project. We're gonna call this one variables. We'll go inside. Great. Our main method. Go to our claws, Select main method. And we're gonna call it variables as well. And click, finish and are Let's begin cutting first. The two variables that I'm gonna be talking about string an integer string Variables are lands of ticks that are usually encapsulated in double quotation marks. As we saw in the previous video, we printed a line of text encapsulated in double quotation marks. What were essentially printing was a value for a string variable. So how do we create a string variable and store values in it? Well, it says photos we first top in the word string uppercase s, and we come upon her name for our variable. So let's call it would Now that we have grated a variable called word and given it to the top string, we need to give it value so we can either close of a semi colon. Great a new life word equals and we create our double quotations again. Hello, close of a semi colon as is, or lines of code we close of a semi cut on. And as you can see, we have now given the string would a value Hello. Of course, we can shorten this further and just write it as follows. We can take away this lon and say string word equals and then that will quotations Hello, close of semi Kerlan. It works the same way. This is a string variable in its value and we can also print it using our system our front line system dot out don't print alone and in sand. I would Now when we run the program, it should print valley and it does indeed. Hello appears in the consul below a net is a string variable. We can, of course, add to the stream variable by adding with in addition, symbol and whatever else we want. So in this case, what if we want to say hello world again? So if our top had willed and I kick run it prints Hello will But as you can see, it doesn't have a space in between space is another character that does need to be added. So we add that in the quotations run the program again. And now we have printed hello world with a string variable, so that's a string variable. But what about an integer variable and interred? Available is, as the name suggests, in number. These numbers are whole numbers, ranging from negative infinity to positive infinity, including zero. So now we need to create an interest variable. Now, as you may expect, we'll probably have to create an injured available by topping an integer that aim of the variable equally in double quotations and the value well into just work a different way than strings to created Interview variable. We'll start a new Alanya and we top and int. Let's give it a name, numb for number, and we can yes, give it a very the same way String but unlock string. We don't have double quotation marks. It is simply just a number. Devil quotations surround text, and since the number isn't takes but the number itself, we won't be using double quotations. If we were to use double quotations, they would be in error because essentially what we'd be trying to do a store, a string valiant into an integer. Now we can also output this number as well. System dot out dot prince mom and inside number. Now when you run the program had a world and five and also just like the string we can add to it So we can add plus and double quotations is a number. Now we will run the program. We see it. Five is a number below Hello world, just as expected. But what about any numbers together? Well, we'll talk about that in next video. This concludes this lesson In the next video, we'll be discussing math and integer variables. 5. Mathematics with Integer Variables: Hello and welcome to your basic Java programming course with Eclipse. And in this video, we're going to do mass with Inter Juve variables. First, let's start a new project to do our programming. New project. There's just called math for no, we then add a main clause, was secluded math like Finish and it's begin. First, let's create an interview variable to work with hint numb equals, and it's given the value of five close of a semicolon. Now that we have an intolerable, we're going to go through the different math functions that we're gonna be using in our course. First, let's create a second into variable int no to equals, and we're gonna give it the Valley off 10 close of a semicolon and now 1/3 variable. We'll put the result int, and it's good result equals zero. We'll give it a value now. First, let's decided function to begin with. Let's start with addition. We go into our interests hotline and we changed the values, too. No, plus number two. But this will then do is call the values from these two variables over here and add them together using the plus function. Now we need an output are result we have given into result of value. Now we just need and put it system dot out dot print line and inside result. Now, when we run the program, it prints the number 15 says you could see it has added the two values from the inter jizz , as well as stored them in the interest salt. Now let's move to the subjection. Function simply changed the plus symbol to remind us, and that is subjection. As you could see, it is printed. The value negative thought, which is great for of modest in its negative thes subtraction function, is as simple as the addition. But what about division Division is the Ford Slash. However, the result would be a Z. You think where you're on the program, you notice it. Prince the value zero. That's because 10 cannot be divisible in five. However, if we were to change the values around number two divided by no. When we get the following two dead, Nevada by far is indeed to if you wanted to see the divisible values that requires a different variable entirely, which we'll talk about in elective video For now, let's switch these places back certain, Um, divided by number two. And let's move on to the fourth function that really to be using in this video multiplication, which is the Estrich symbol Shift eight on the keyboard. Now we run the program five times. 10 is indeed 50 and there's other math functions. Now, before the video ends, we're going to simplify the program to save us some lines of code. We could take this the math itself, out of interest. Sult delete the lan and pasted in the output. The result is the same. Of course, you can go one step further and put it all into one line. Instead of using any variables at all, we can take the values and use them instead. So five terms 10 and we run the program. It works just the same. Of course, you won't always have the option to choose your numbers, and you wouldn't need to use it with something as simple is this So variables are most likely what we're gonna be working with. And there you have it math and inter variables. And that concludes, is listen, in the next video, we're going to start with if statements 6. The If Statement: hello and welcome to your basic Java programming course with Eclipse in this video, we're gonna learn how to start using if statements and let's begin for we Ratter. If statement, I should explain what it does and if statement is a way of checking Donta. So, for example, if you were to create a ticket system where only people who are above the age of 18 are allowed to do whatever it is, be it going to the theater or so on. Well, this if statement that I'm about a great will do just that. First, let's create an interview variable and give it the value off 18 int number equals 18 close of a semi column, and now we want to create it. If statement that will check this interject if records no is greater than 18 and then we add these curly brackets after In between, these brackets will be code that runs only if the clause none greater than 18 is fulfilled . So let's create an output system, not out dot print blood records, and inside it will have a double quotation saying older than 18. Now, if we were to run the program, it wouldn't print anything. As you can see, The reason this is is because numb is not greater than 18. It is 18 itself. But of course, with the greater than and equal to. Unless then, you can also have greater than and equal to by simply adding equals after the greater than sen Alphonse to run the program again, it would print older than 18. Of course, this output doesn't make much sense compared to what has been written. So let's adjust the output to 18 or older. Were you on the program? And now we have a sound program that does check if a ninja is 18 or above. But what about the functions in a clause we've used great to then great to that equal to. But you can also use less, then less than equal to. But what happens if we looking for specific value? Well, what we just use equals no, we would use, equals equals. This avoids any errors, but it does the same thing, So if a number equals equals, 18 system out print would run. So then let's adjusted to is 18 and when we run the program, we can see that it works trust fund. So now we have a basic, if statement. But what happens if we want additional code that runs? If the clause is not fulfilled? Well, go to the end. Click enter after the closing brackets top and else again enter and the same set of brackets. This is the curled in between these brackets that will run if the clause is not fulfilled. So that's great in output system out dot print Salon and we'll have in double quotations is not 18 so we know the first part works. So let's change the interview. Barely 2 15 And now if we run, the program is not 18 so it is working correctly, and that is an if statement. But what happens if we have multiple chicks? What if we need more than one close? Well, in the next video, I'll show you exactly how to deal that. That concludes this lesson in the next video art teacher about end or and nested. If statements 7. And, Or and Nested If Statements: Hello and welcome to your basic Java programming course with Eclipse. In this video, we're going to discuss the end and all in the if statement as well as nested. If statements first, let's address the era that are mentioned in the previous video. What would happen if you'd want several clauses? Well, these could be handled many different ways. For example, of you in a chicken daughter top with several chicks, you can either use the and NOR or we can use nested if statements. Let's start by looking at end and all. As you could see, I'm still my previous project, since we're still working of if statements. So let's remove this basic if statement and start at the beginning with a normal Introgen. Let's give it a nice Valley off 20 and now we're gonna create an if statement that needs to check if the number is above 15 and below 25. So that leaves a small gap off 16 to 24 not inclusive off 15 and 25. So how do we do that in any statement? Well, it's his photos if number is greater than 15 so that's our first clause. But how do we check if it's less than 25? Well, we topping and symbols twice, just like our equal symbols. And then we add our second close. None is less than 25 reading at all brackets and, of course, are put system. Don't act that print line Numb Plus is greater then 15 and lace and 25 using that we have just addressed the era. How can we and multiple closes? Well, we can add more and more after this as well. Of course, this does narrow down numbers, but it can also applied to other types of daughter as well. But for now, we're going to use images, so that is the end. But what about all? Well, let's start with the new example. Suppose we want to check to see if the number is either 20 or 25. The if statement would look as follows If open brackets number equals equals 20 and you're all symbol is the straight vertical on twice. So that's no Eco's eagles 20 or numb A goes eagles 25 brilliant and R brackets and, uh, put system got out that front line. And inside the brackets number is either 20 or 25 now if we run the code, we said it works out just brought. But if we have 21 or any other number that isn't 25 or 20 we'll notice that the code does not run. So with and statements, all closes need to be fulfilled. But if all statements only one close needs to be fulfilled, so that is the end or all. But what about nested if statements nested? If statements are also a very important part of programming, it's an s statement within an if statement. So let's have an example where we can use an if statement the user enters in a number. And if it is zero, it doesn't run the if statement. But if it is above zero, it runs the if statement. And inside there are several If statements, little scan the daughter let me break it down for you as I write it. So let's change our interest 20 to begin with, and I'm gonna show you another close function. First, Let's take away everything. Yeah, up to the if, and I'm going to rot in the following If reckitt numb exclamation point equals zero and then inside an output the exclamation equals means does not. So if numb does not equal zero, then it will run whatever's inside those brackets. So this is useful for avoiding certain values and can also be useful for later in larger programs to cut through code that isn't necessary. So now we can check to see if he uses ended in zero to scan the age or not. If it is zero, then we move on to the second. If statement, if and um is greater than 18. As you can see, we haven't if statement within an if statement and inside the second of statement, we have a output system that out Dutch fronton and saw the brackets in double quotations we have Age is greater, then 18 and we can add in else, of course, for daughter that is below 18. System out. Don't print salon age is 18 or less, and there we have it. So let's taste it out at the moment. Our number zero. So if our Crist close works correctly, the inside if statement won't run at all. So when we run the program, we noticed nothing is displayed. So checks the first clause and, as you can see it is fulfilled, skips all the code inside the break. It's and continues of the program right now. There's nothing after the of statements, so nothing is uprooted. Now let's change the values. Let's top in 20 to test out the first part off the if inside. If so, you run the program. Ages great to than 18 saw inside. If statement is working on our first, if statement is working, so are nested. If statement is almost fully tested now, we need a test to see if it's above zero but below 18. So let's change the value. So let's change the value of a numb to 15 and run the program ages 18 always, and that is an if statement, you can have multiple clauses all within several if statements. As for how many, if statements you can have inside an if statement as many as you'd like. You can even go further than to have if within an if and so on, of course, with if statements, it's a good idea to keep track off the Indians. So that way you could see well if Salah, especially if they aren't in love. You might find yourself confused when using multiple Maced it if statements and there you have it, the end off if statements as well as nested. If statements that concludes this, listen, in the next video, we'll learn about the wild loop. 8. The While Loop: hello and welcome to your basic Java programming course With Eclipse in this video, we're gonna learn about the wild loop. The while loop is a very useful piece of code. It allows you to repeat code without having to rewrite it over and over and over again. Supposing that you have to their requirements for making a while There are not so different from making an if statement, you need to have some piece of daughter or variable to check before you can continue running the loop. First, let's create something called account variable. This variable gets placed inside the well look and gets constantly updated as the loop runs . The loop will keep checking this specific variable, and when it closes, met the loophole in. So First, let's create that variable int count equals zero. Now that we have created the variable, let's move on to the wild while and then our brackets. Now, as you know in our if statement in these brackets will be the clause. The clause of a while loop is if the clause remains true, the loop will continue to run, so it needs to reach a point where the lip will be false. So for now, let's make sure the clause registers the count Fair bought the moment as true. So that's where the loop will run again and again. We can also use this dry advantage and choose wind loop wind. So count is less than far. This close means that the loop will run until count is no longer less than five. So let's make sure that inside the brackets of the code area that count eventually does reach five or higher. So that way, the loophole end. This could be done by simply adding to the count. To do this, we can add a simple one counter. So let's add one to count as many times as the loop runs so count equals count plus one. What this will do is add one to the count's value each time the loop is run. But how can we check this? Well, we can create a simple output that'll write out exactly what the council really is. System got out dot frontal on and inside, we put account available, and now let's check to see if the program works. As you can see, it has run five terms as designed now Of course, we can make adjustments to this wild look. For example. We can simplify. This count equals count, plus one to a much shorter line occurred. We simply erase everything up to account and top in the following plus. Plus, what this does in Java is add 12 counts value. So if we run the program again, the result is the same as you might have guessed. Plus plus adds one well minus minus. Deletes one. So if we want to run our program, it would never end. However, it would continue printing counts value, so let's see what would happen. As you can see, valleys are being printed very fast, physical. Peter runs the code over, over and over again, and the way to end it is to click the terminate square button over here. So in that short amount of time that the program is running the loop repeated over two million terms. Now let's return the counter to plus plus for now and work on adjusted the clothes. As I've said, the loop will run as long as the clothes remains true. So what happens if we just less than two exclamation point equals? Not equal to five, and it works just the same way earlier on this five times because it adds eventually up to the value of farm. But what happens if we say count equals equals zero and we run the loop? Well, then it only runs once because the moment campus plus adds to it the Lupo end. Of course, if you remove calm plus plus, it will continue to run printing +00 again. I can, of course, show you this by simply commenting up the line of code of two Ford slashes. So when I run the program again and repeat zero and zero over and over and over again, let's remove the coming. Now let's say that it was never true to begin with. So we make counts initial value one, and we leave the clothes as is. We run the program. Nothing is printed. The loop doesn't run just like the If statement, the code inside the brackets every year is completely ignored because the clause was false from the very start, and that is a while loop, and that concludes this lesson. In the next video, we'll discuss the full 9. The For Loop: hello and welcome to your basic job programming course with Eclipse. And in this video, I mean teach you how to create and use a for loop. In the previous video we learned about the while loop, we learned that the clause needs to remain true for the loop to run in order to have a loop set sail edited, run a certain amount of Tom's, we would use a count variable, an integer that would steadily add up won't degrees to a certain vani until the clause turned false. But of course, of while it needn't have account variable as long as the close turns false, then the loop stops so it could be any top of variable as long as the claws returns false. What we're gonna learn about in this video is the for loop and how it differs from the world. Well, first, we're gonna address the structure of the for loop. It is very similar to that off the one lib, except the clause is rather special. First, I'm gonna create the for the brackets and I'm gonna add in the code in brackets. And now I'm going to insert a clause the clothes looks as follows, for example, and I equals zero semi Colonel. I is less than five semi colon I plus plus. Now there are several factors in this clause that are very different from that of a while. It there are three sections in the fall of the first section. Separated from the rest by a semicolon is entire equals zero. We're creating a variable in giving it a value of zero. The next section looks like a traditional clothes. I is listed five something that you would see appear in an if statement a while now and next we have our plus plus I s steadily getting added one, as you may have guessed but we have done is create a comparable and started inside the clause Unlock our first wild If the results would be the same all we need is an output. So system out dark Prince Alan and inside the brackets we'll just have a simple output off I as follows. Now let's run the program. It has the same output is the while loop we used in the previous video without first example. What we have done is created a simplified while new with account variable Of course, this variable can be tempered with inside a loop itself if you can print it out in the loop , and that means you can also add to its value. So if we wanted to change the clauses in point, we can add more numbers to it. Or we can even change the value completely. So you see everything R plus plus, and the result is there a to four because as each time the loop runs and runs R plus plus twice the 1st 1 in the clause, the sick one in the program itself, so too, is added each time, and thus the loop ends sooner. Now let's work with another example. Suppose we ask the user to maintain the value that I the intent, er and sound close should not be able to reach. In other words, determining how many times a loop a run well, we can instantly just create another variable into numb equals and whatever the uses value be. We didn't say 10 close of the same Yukon. We can then add in our fully so I is a list then number. We didn't move this lot of a here and run the program. What we should have is a loop that runs 10 times and we do, indeed 10 values. So the loop has run 10 times. So, like a while, lift the user can still affect the loop itself. You can choose at what point the loop ends, and as for when it begins, you can also do that as well. So we have into number 10 right now, as our let's change it to int number five and we're gonna put numb into int. I equals numb and we'll make I listen. 10. And it does indeed run five times farther lease have been printed in the output box. Now you may be wondering about user input. How do we get user input? We can't have the user interfere of the code. That's the program is job. So how do we create a way for the user to enter values without having to temple with the code itself? That is something I'll show you in the next video that concludes this lesson In the next video. I'll teach you how to get user input through dialogues 10. User Input through Input Dialogs: Hello and welcome to your basic Java programming course with Eclipse in this video, I'm going to show you how to get user input. First, let's create our project. I'm Inequality user input. Now that we have created our project, I'm gonna show you how to get used to input using the show input dialogue method. To use this method, however, you need to import a package to import a package. Go to you. Package user input at the very top que canta and top in the following import Java X, don't swing dot star. Now, let me explain this land before I continue, the import line imports a specific package, namely the Java X package and all their package. I'm importing the swing class and what makes it someone 14 from the swing class? Well, the star isn't exactly a method name. What the star means is that it's importing every myth it from that class. We need and use all methods from the job extract swing class. However, this is much easier way to make sure that we don't encounter any further errors. Should we do need anything from the swing class now that we have import of the package, we can begin coding. Now. As you know, there are several daughter tops. We have worked with two so far string and indigent. In this video, we're only gonna work with string. The reason being that the swing method that we're gonna be using returns a string so anything else needs to be converted to a specific daughter top. As for those conversions that will be done in a later video. Right now we need to know how to get user input. So let's start by getting a string from the user. First, let's create a string variable that the value will be storing string and it's cool it name . Now we need to give it a value. Now, how do we give values Two variables we used equals. But does that work with views? Input as well. It does indeed. We topping equals. And now the following code to access the show input dialogue. J o option pain don't show input dialogue. Now we run this line of code a box will appear asking the user for input. What appears always asked from this box is in between these brackets. Yeah, so inside I'm gonna put in double quotations. What is you'll name? What this will then do is generate a dialog box with this message. What is your name? And leaving the user to anti in a value. This value will then be stored in the name variable. So now we know how to do that. But before we can move on, we need to have an output to test to see if it works. So system got out the print Lon and incent name. Sanaa. Let's run the program to taste it out. As you can see, an input box has appeared, and it's that of a question top asking What is your name? So if our top in the Value Jon and Click Inter for Cocaine were noticed that John is printed in the output box. So just like that, we've got daughter from a user and we've printed it out. This is a huge step in programming because receiving daughter from the user is one of the most important tasks that a program it can have. And there's none more simpler than just asking a user with an input box. Now. What would happen if we import it in number? Move around the program again and we topping the numbers such as 20. It works such as fun. We have the value of 20. So can we do meth with this number? Well, we have name and South America. It's let's test it out by adding five to it and using the same value again. So running the program we topped in 20 like okay, and you notice that father was not added to 20. This is because 20 was a string. It was not an integer. So by adding factor it all we're doing is adding father next to it as if it were string of text. If you wanted actual numeral values from a user, which most cases you do need to have, you're gonna have to convert the user's input to an indigent to make it workable with math functions. And that's gonna be in the next video that concludes this lesson. In the next video, we'll show you how to convert integer and string variables thing 11. String and Integer Parsing: hello and welcome to your basic Java programming course with Eclipse in this video, I'm going to show you how to convert variables, string and interject first. What you need to know is that variables can be converted to other tops. Of course, not all variables can be converted to certain tops. For some of them, it is impossible. However, we're gonna be working with string and interject in this video, and these two can be converted to each of each other's tops. This conversion process is known as passing, so when you pass a variable, you converted from one daughter top to another, such as converting an indigent to string committee known as passing an integer endure string. So here's an example how to pass an integer interest drink variable. First, let's create an integer int no equals and let's give it the Vario far. Now how we convert this inter gentry a string is as follows string word equals, and how we convert the number into a string is by double quotations open and close of no value, plus no because of a semi cone. And just like that, we have taken the numbs value and turn it into a string so we can taste this art pop poutine dot print on and inside these brackets output would plus fun Now if it was still an integer, adding, these together would produce the result. Now, if you're a stone into GIA, output, Penis would result in 10. However, since it is a string, the result is 55. So, as you can see, we have successfully converted an integer into a string. Now, how about the other way around? Well, this process is a little bit more complex. Let's start at the beginning. Let's create a string call. It would equals and we'll put in double quotations the number 10 close of the same coat on How do we convert this 10 into an insurgent? First, let's create our indigent int num equals. And now, to convert it, we use a message known as the Inter Gen Dark past int. So we first topped in the following into jail dot plus capital I N T brackets and inside the brackets, we put the variable name clothes for Sammy. Come on. And that is how you convert a string into an indigent. And as before, we're gonna test it out of an output system. Don't out done print land, and we're gonna put the variable numb minus five. And when we run the program, the result is far. 10. Mona's father is indeed five. So now we successfully converted a string to an integer so now we can pass to tops to each other. We can also then use this to our advantage to get user input of inter jizz. So let's go once more back to the beginning. Create a quick, a digit variable. And to save us Tom instead of converted in a sick and lump, we're gonna top in the intelligence dot passed into and in Sandy's briquettes we're gonna have input dialogue J Option, the pain dot show input dialogue. And it's all the brackets of message, such as into a number enclosed in a semi colonel and another quick output to test to see if it works. Says something out that principle, Um, and inside the variable name plus five. Okay, we're ready to taste our program. So let's say are into inner value off 10. What it should in print is 15 in the output bucks, and it does indeed, and that is how you pause string and interject variables that concludes this. Listen. In the next video, we'll learn about the child variable and its passing. 12. Char Variable and Parsing: Hello and welcome to your basic Java programming course with Eclipse. And in this video we are going to look at the chart variable and it's passing. So far we've looked at two variables. The string and interject string contains a line of text and in tages contain numbers. Char variables contained single characters. Char being short for character to create a child variable is as follows the top inch are and the name of the variable. Let's say C H equals to give it a value. We use single quotation marks, which can be tea or five or any single character and close of semicolon char variables. Another daughter tap that could be used to get small characters. Now, how about its passing? How do we convert a charter, a string or interject? And the other way around? Well, two converted charter string is the same way. We convert a interject to a string we get a string string would equals and we have double quotation marks, plus ch closer to see me. Come on. And just like that, we have converted HR into a string and to convert a chart to an integer is as follows and number equals integer don't pass and inside the brackets double quotation marks plus the child's name closer to see me coat on. What we're essentially doing here is converting to a string and then to an integer, because it's not possible to use interject off powers. End to convert HR into an inter jailer. It's a simple adjustment, and it works. And now what about the other way around? Converting a string to a char uses a different type of method is as follows. So let's say we create a string. Good test equals and we give it would as it's very we then create HR cool a tester equals and what we do to get the very off test his top in very real name and a myth it called Char at and inside the brackets zero zero refers to the first place in the word being that w 00 is one are is two nd is three. So by using char at, we have selected the first letter W and it will be put into arch our tester. Taste this out. We can use his employer put system got out dot print lamb our system our print one inside the brackets, we write Testa and to avoid any areas from the Inter Joe we've created earlier, we're gonna comment it out so that where we can run our program solar to run. And it does indeed print W the first letter of wood. So we have converted a string to a child. But what about an integer to a chart? Now? Converting and in ginger into a child is the same way. We've converted trial into an integer. So let's create int into numb equals and give it a single character of six closers going on . We'll use our tester. Char again, said Tester equals and we had great brackets, double quotations. Bless, Numb don't charge at zero close of a semicolon. And now let's copy this are Portland and paste it below. So now we should see W six, and we do indeed who have now converted it interject into a charge that is the third variable top. We'll be learning in this course that concludes this lesson. In the next video, we'll learn about the double variable top, and it's possible thing 13. Double Variable and Parsing: Hello and welcome to your basic Java programming course With Eclipse in this video, we're going to look at the double variable, and it's passing into other variables. We have looked at char variables, string variables and in Tages Charles containing single characters, strings containing lots of text and images containing whole numbers. Well, doubles contain more specific numbers for action on this. For example, 5.55 point 67 or 10.9 thes are double very real numbers. To create a double is as follows. Double Denham equals 5.5 close of a semicolon on. Just like that, we've created a double variable end of given it a double value Black images than rats functions work with it as well, so you can create a simple I put system about out of print line. And inside the brackets, you can have Denham plus 14.3, and when you print the result, it prints out a double 90.8. So that is a double. Now let's look at the passing first. Let's look at converting doubles into the other variable tops before we can put other ruble tops into a double with converting doubled to indigent. It's very simple. First, let's look it. Converting a devil to an interview it says follows int num equals. And now we put in records I and defiant and outside of the brackets, we put our very building dino close of a semicolon. This converts the variable into an indigent and, of course, simplifies it. So that's great in a simple output system dot out Dr printed on them and inside, we'll put number. Now we're on the program. We can see it's converted 5.5 into five. Of course, it doesn't round up. It runs down, just taking the first initial value before the point. So, as you see, have changed it to Farpoint non. Yet we have five printed, so that is converting a double into an indigent converted into char is similar to that off a string as well. Char ch equals and we'll put in brackets string plus Dina don't char at zero and again, this will only take the first character as well. So system out that printed on CH closer to see McComb. Now we run the program Father's again printed, so that's converting a double into a charm and converted it into a string again is very simple. String would equals double quotations, plus Denham, closer to see my coat on system got out. The principal, um, would, Of course, these last two values are not introduce or doubles so you cannot do. Math varies with um, but wouldn't committing you to an int. You can still do math. So, for example, plus five to date and we'll run the program. It does work just right, so that's converting double to the other three variable tops. Now let's convert other three variable tops into a double. That's a raise. Everything start at the beginning. Great A into chair first into numb equals five. Because if you see me coming now, we create a double double. Denham equals and and it's a simple is that now when you print out the value for Denham Sister Brundtland de no on the program, as you could see it, has been converted into a double. An awful a string string would equals, and in double quotations 6.7 was that a semicolon? Now to convert it Denham, because double dot pass double and inside would plus this any gun quick output numb system out of print. Um, Dina closing a semi colon. We're on the program and it does work. Indeed, we have converted a string now to a double. We've committed interchange a double A Now for char. Well, this can be done the same way as converting it first to a string and then into an integer. So it'll look as follows. So first, let's create a child. John C. H equals single quotations off close it a semi colon. Now Denham equals double that pass double and in brackets, double quotations open and close plus ch. Closer to see me, we printed out on what we should get is Pfaff system out dot print on de no and we do. Indeed, that is the double variable and hard to pass it into other variables as well as how to pause other variables into a double that concludes this lesson. In the next video, we'll discuss the project for this course 14. 1st Project Discussion: Hello and welcome to your basic Java programming course with Eclipse. And in this video, we're going to discuss the project for this course. For this project, you are to create a program called Ticket Tester. In this program, you gonna ask the user five terms to intend an age you'll in test this age to see if it is above 18 not inclusive 18. Each time that it is above 18 you keep count, and each time it's below you keep a separate count as each ages entered us, then print the age Kerlon space and then say, with its entry or no entry, all of this must be done using two if statements and a while once the while loop has reached its limit off our your then to print out the results as follows the number that are not allowed entry, the number that are allowed entry and in the funnel on your to, say, the percentage of the testers that all our entry into the program Do not worry, However, I am not throwing you into the deep end. Here are some tips to get started. You're to first create three inter jizz one that keeps count of the new entries, one that keeps count of the entries and 1/3 that keeps count for the wild off the turtle inside the wild. If you'll have 1/4 integer, this integer is the Agent UJA, to which the user will be ending in their values. You will then have your if statements inside the wild and at the end of the wildly you're create three system our print lands that will print the final information a k a. The ones that are allowed entry in the ones are not allowed entry and the percentage of all the testers that are allowed entering into the program that concludes this lesson in the next video. I'll give you my own search of this project. 15. 1st Project Answer: Hello and welcome to your basic job of programming course with Eclipse. And in this video, I'm going to give you my answer to this course is project first. Let's create our project. As you know, our project is called ticket tester. So New Java project a ticket. Testa will be the name not we've created the project within. Add the Java class and topping the funnelling a ticket tester. And, of course, adult public static void Main click finish. Now we have a program all set up to start programming. Let's first import of package that we're gonna be needing for his program Import Java ex dot swing dot stone Because, as you know, we are gonna be working if user input. So we're gonna need this package to make the code that we need work. Now, let's create the 1st 3 variables that I mentioned in the previous video. No entry which will keep count. How many know entry as they are int entry. Okay, which will keep count of the number of applicants that are not entry into the program and int count, which will work with a while loop to make sure that the loop runs five times. And without further ado, let's get straight into the wild. While count is not equal to five says we want to program to run five times and now for the cool barcode. First, we're gonna ask the user to intend an age. So we're gonna get into variable to work with into age equals in TJ dot pass. And next, we're gonna add in our jail from pain not showing put dialogue J option paying that show input dialogue close of a semi colon and inside the brackets I'm gonna have a small message sane in tow Age to see if allowed entry 19 minimum. Now that we're it in that line of code, we can move straight onto the if statements, the 1st 1 will be for the in Trias. If age is greater than 18 we will be in print out of land as follows System got out Dark print Alan alone, as specified, says we was print age plus colon space and in this case, entry. Since it's the entry, if statement and we got to keep count of the entries so entry plus plus to add one to the entry value Now we can copy this if statement and make slight adjustments for the no in trees. So Chelsea control v. No, we have to make sure that it's age is less than or equal to 18. System our print land, age, colon, no entry. At the same time, we're gonna make sure that the no intrav able gets added on not the entry available. No entry plus plus. And that's the final If statement and before we exit the while loop move on to final output , we would add one to the comparable. Otherwise, our lives would never end another. That line of code is written with move onto output system out of print, lamb and inside the sprint plan, we're gonna say how many are not allowed entry. So that's no entry plus quotations. Uh, not, uh, entry. We can in copy this line make the slight adjustments again, except this one for the entry variable, sir. Entry and are allowed entry. And finally, the last line of code system out Prince Lamb, us that this I said in this last line of code, that injury asked that in this last line of code that the percentage symbol on it asked that in this last line of code that the percentage off entry years be displayed. In order to do this, we know they are far, so we times the value of entry by 20. Of course, you can work up a double variable if you wanna be ruled process and you want to finish off the program. But for now, since there's only five and we know that there's only far recon it at a simple brackets into the program. And it saw these brackets injury times 20. And then, of course, we had a small message with the percentage symbol. Percentage off testers made it into the program, and there you have. My answer to this course is Project, so let's taste it out with far values quickly. No entry, which is correct. Let's stop in 23 entry, 19 injury and just in extreme 1 100 And now we see our final display. Two are not allowed entry, which is correct. We have two that are not all the entry at the very top three are lower entry, which again is correct. So we have off our values and it has checked him correctly. And of course, our percentage. 60% of testers made it into the program, which is correct. And there you have my answer to this project. Of course, this could be done in a simple way. Some adjustments could be made, some cause saved, and I expect that some of you will have different answers to mine. This is expected when it comes to programming. There's so much freedom to work with that is bound to happen, that many programmers have different ideas of heart. If solve a problem, this is just one of mine. And if you struggled, I hope that this answer will help you. That concludes this. Listen, in the final video, I'll give you my conclusion to what you have learned in this course. 16. Introduction to Advanced Programming: Hello and welcome to Section one of advance job programming. With Eclipse in this section, real be discussing methods. Methods are small programs that could be called upon using a single line of code that can be used to change values or create new ones. For example, in my previous course, we use the dot equals ignore case method, which was a small program built into jogger, allowing us to ignore the case off a string we'll touch upon this method again and many others. All misters share a similar structure. The variable name dot the mated name and closed with a set of Brecken. Some methods can contain small values in Sala de sits on brackets, but some do not. The methods you'll learn in this section will no doubt help you in the future. Too few programmers use methods, even though they are so easy to use. You'll notice this as well. By the end of the sixth. In the next video, we'll learn our first method, the to upper case method 17. The toUpperCase Method: hello and welcome to advance drove a programming course with Eclipse. And in this video, we're going to be looking at the to upper case method. And before we begin, let's create our project. So New Java Project. And let's just call this one there case taste, click finish. Then we needed right click on the Source folder and create a new close. We create a public static void main course, and we call it Case test and click Finish. Now we're gonna be using use the input in this program so we need to imports the Raj packages Import shover extort swing not star. Now that we have the Rod packages, we can start programming first. Let's talk about the to upper case. Maybe mid to upper case. Make it, as you may guess, changes something to the upper case. And as you may have really guessed it is a string. We are going to get an example string from a user, and then we're gonna use the to upper case method to convert the entire string into uppercase letters. So first, let's create a string called Work Equals J option Pain. Don't show input Dia dunk, and it's out of the brackets into a wood close of a semi colon. And then we have our first line of code. Now, we didn't use the method. And of course, we need output. The result. So we can do that in one more line, we create a system out. As we know, May said, Structures begin with the variable name. I don't to upper case close with two brackets and there we have it. Now let's taste out our program where we run it and input box appears This is what is greater without first line of code. We're now going to input a word such as Hello which immediately get placed into the string variable work. And and this is to our print line. The to upper case method will be used and convert the wood hello into its upper case letters. As you can see in our put box, we have the word hello in food caps and easy start to this advanced course in the next video. We'll known about the to lower case, miss it 18. The toLowerCase Method: Hello and welcome Teoh Advanced Java programming course with Eclipse. And in this video, I'm gonna be showing you the to lower case method and why it and the to upper case method are fixed methods. First, let's create a project. You job project, project name. It's going lower case test, like finish we then at our class to the source folder, Give it the name. Lower case, test like finish. We're gonna be using user input just like the previous video. So we're gonna import the right package. Java ex dot swing Don't start. And just like the previous video, we're gonna ask the user to enter any word and stored into a string variable. This is what we will be using. The myth Adan String word equals J option pain. Don't show input. Die along into a wood closed of a semi colon. So just like full and we have put it the same way system got out, would and of course, the method not too lower case as you may have already guessed, this does the reverse off. The to upper case means a convertible upper case letters to the lower case. So when you run the program that's topping a wood with several lower cases. Age E capital l. Okay, so can okay, and it's all converted into the lower case. And so that was simple and easy to do, just like the previous video. But what is a fixed method? If X method is a method that will only a power to a certain daughter top meaning all daughter tops that are not specified to this method will be ignored. You'll find that this is quite common in scanners, which will be learning later in the course. But for now, let's give you an example of what this does to certain daughter tops. So I run the program, and its include a number and interject daughter top. So we include the capital age, you know, and top of the number, such as five. When you run the program, five is ignored, but the capital letter is checked, as are all those string letters. All of them are technically being converted to the lower case, but some remain, so you don't see a difference. Also, the method want to play two characters that aren't laters, So capital h hello. Uh, and a question mark Run the program, and, as you can see, it has been ignored. This is because the method is fixed. In other words, it applies only to strings. So let's test this out further by using HR. Variable has changed the string to char and to convert it dot char at very end zero, you'll notice that we have an era. Would A to lower case can only apply to strength. So, as I said before, it is definitely a fixed method because it won't convert HR variable. The to upper case into lower case are fixed methods fixed to the string time that concludes his lesson. In the next video, we'll learn about the is letter method. 19. The isLetter Method and Boolean Variables: hello and welcome to advance Java programming course with Eclipse. And in this video we're going to be looking at There is letter method before we can learn the is legitimated assured Latino about the daughter. Top billing ruling is a very simple daughter Topic was that can only hold three values. True, False? Oh, no. If no values given to create a Boolean is as follows. Feeling B equals true, the name of our building variables B and its value is true. The reason I'll tell you about the 1,000,000,000 variable is because most methods that you've learned in your basic course is returning a boolean variable mainly when it comes to . If statements in our loops it needs to remain true in the clause for the loop to run awful the if statement to run the code between its brackets. So if the clause returned spells, in other words, if false billing in the loop doesn't run, all the if statement doesn't go, what is little does is check a character to see if it is a letter. In other words, if it's a dizzy in the capital Noah case, so let's once again work with user input it's imported package Gentleman X. Don't swing dot stuff Place is very common. A now is did a true let's use the J option pain. Let's remove this 1,000,000,000 of the him and great HR Babel Char C H equals option pain. Share in foot dialogue. Enter a character that char at zero closed For Simic on this is a quick way to convert the string into a job. So now we have value that are restored in the variable ch. Let's use our method and return a 1,000,000,000 available. First, let's created Boolean to store the 1,000,000,000 really be equals. Now How, MAY said belongs to a special class known as the character costs, meaning that these methods can early apply to characters, meaning that these methods only applied to characters. So at the same time, we need to call upon the character class when using this method. So how we use this method is very different from that of using the to upper case or to lower case we first called the character and then we top of the method is later and inside we have ch close with a semicolon and there we have it. The Isleta method. Of course, we need to see the output to taste it out. System dot out Got printed on Be So now let's taste it out now Let's taste it out. We run our program, we get input books. Now let's taste a false daughter tough. It's topping a number. It returns false. But stopping a character such as percentage symbol, it returns false. And finally, let's stop in a letter T What's returns? Truth and Capital T, which is the same result. We can, of course, them use this in if statements at four loops. So let's make a quick, if statement removing these last two. Lance if and inside the if statement will have character dot is later ch. So now we have an if statement and a check method. That's great. A simple output inside the if statement system got out printed on and inside the print line will have a simple hello, just a small shrink. So that doesn't know if the if statement returns true. So we run the program. Let's top in a letter to make the if statement true, and if it works correctly, it does. Indeed it will print teller and of course it would run if we top it anything else, such as a number or if we top in a character. And just like that, we have the is litter method very useful for checking daughter That concludes this lesson in the next video, we'll look at the is digit method. 20. The isDigit Method: hello and welcome to your advance job and programming course with Eclipse. And in this video we're gonna be looking at is digit method. We create our project within at all class import Java X not swing that star a cynical on Now that is digit method. What these digit method does is similar to that off the is later checks a character and sees if it is a digit. In other words, if it is a number character. So let's great what we've created before. Very quick. Creditable char c h equals J option pain show input, dialogue char at enter a number of feeling being equals character That is digit ch closed the Simic our own way, of course, then can use this 1,000,000,000 very born if statement check if be and then a simple output system not out of print lan and inside double quotations. It is a number, and since we're working on what is here a very small program, let's improve it quickly within else. That prints out a message when character is not a number system out of print lamb and in double quotations, it is not a number closer to cynical. Now let's run, are small program and tested out into a number. Let's first test out the wrong values. So let's test it out with a letter such as T. It is not a number. It has great characters. That is the percentage symbol, not a number. But when we talked in a number such as three, it is a number. So our program works correctly, and that is that is digit. As we learn these methods, you'll notice that we are slowly developing a larger program thistle practice for the end of the section, we will be using all the methods that we have earnt, and right now we are halfway through. That concludes this lesson In the next video we'll learn about the is what space method. 21. The isWhitespace Method: and no. And welcome to your advance job a programming course with Eclipse. And in this video, we're gonna be looking at that is what space method Now that we have created Project reimport the packages, we move straight onto our code. As you know, that is what space mate that belongs to the same clothes as the is Litten is digit method. In other words, it belongs to the character. Close. So let's create a similar program. Now Charge CH equals J option pain. I don't show input dialogue. Injured a character not sharp at zero and straight. After this trial variable, we'll have a 1,000,000,000 billion test equals character. Don't is what space and inside ch close of a semi colon now has any taste goes. We need an output to see if our program worked quickly and his print test. We intend a character such as t it returns false. So the building is reading the is what space method correctly. You run the program again and the right answer just a wide space. In other words, praising the space ball. It'll create spots based character press okay, and it is true. Another simple chick. However, this chick is what space method is just a Zim Porton as any of the others that we've learned so far. There is white space method is used to determine spaces between words. In other words, with the right program, we can use the is white space method to determine where woods are on a string as well as how many words are how long each would is and so on with the simple method weaken drop of information from no daughter. So how would we read? A. So how would we read a string using the is Wat space method? Well, we had simply used the char it in a loop. In that loop. We normally have the R variable a counter. We then place the counter in the chart at variable and using an if statement, and that is what space we can determine at what place certain words are. It is incredibly useful because this is a very pro tip idea. Off scanning strings and scanning daughter is very important when it comes to programming and allows us to read information from the daughter that uses present as well as large texts and these all the three character methods that we have learned in the section of the course is digit is later and is what space. All three of these methods are just building blocks towards bigger programs. Some of these programs I've already touched upon with you that concludes this. Listen, in the next video, we'll learn about the length method. 22. The length Method: hello and welcome to your advanced Java programming course with Eclipse. And in this video, we're gonna be looking at the length method way are gonna use user input. So let's import the packages. And now let's be in. What you should know is that the duct length method does not belong to a class. Like most of the methods that we will be using the length, May said, works with the variable full stop in the mated name and then brackets them. A specific method that we're gonna be using today returns an integer value, meaning If we want to store the value that this method produces, we're gonna have to use an integer variable. What this method does is measure strings. It counts the amount of characters that appear in a string and produces a number. And since it is a method that produces a number where you have to use an inter Jinnah variable to store its value, But first let's create a string that the use or input into, and then we're gonna take that string and use it with the length Method string, I would equals J option pain, Dutch show input dialogue close of a semi colon and inside, let's ask the user to enter their name. Now we are going to create an interview variable that we're gonna be storing the value into numb equals. And now we use the method we first topping the variable name that we're gonna be using the method on wood dot legs and then our double brackets close of a semi colon. And so simple is that, of course, we need an output now so we can start Testino method and then I'll pose a hypothetical program first. That's great system out front line and inside we'll have numb. Okay, Now let's run the program. So now we're gonna test it out with a simple name, John four characters. So if our method works correctly and it does indeed, we have full in the output books and next one more test. This method works with all character tops, meaning if I were to tap in a number a lot space and litter another wide space and a character Montreal via in total is five characters white space, a number character in a letter. But all are included in the length method, as you can see here, so the dot length myth that doesn't pose much use when it comes to working with sentences. But what about passwords? This is the hypothetical program that we're all quite familiar with when we create an account with a service, it asks us to come up with a password. When we create an account with a service, it asks us to create a password. Usually these passwords have a minimum amount of characters such a six or seven, that very small piece of code that scans your password. The dot length method is what is being news to scan your password. In other words, we can create that miniature program that scans passwords. First, let's adjust our input box. Enter your name should now become Inter a password. Now that we adjusted the text fall, let's adjust the remaining code. Looking at what we have, it'll be far quicker to start from the beginning, so let's erase these two lands, topping if and creates a quick if statement. And inside the if clause, we will have word doctor length double brackets. Greater then, and let's say we want the pastor to be greater than six characters. So we put in six So if the word length is great in in six, characters will print out the following system that out. But print run and in double quotations. Password is valid. Of course, we need tohave else in case it isn't else. There's copy this line of the young, paste it and then we just add not about it. And what we have now is that very simple program, one that was Scan your palace would and check to see if it's long enough or not. If it isn't, most will have an additional line of code that reloads the Starts page, asking you to enter in your pursuit again. So let's run the program. Let's create a short one first as his top in John Again Password is not vented. But if we run the program again in Top in the Wood for a Grameen, which is more than six characters, we'll see the password is vend, and that is the length method that concludes this lesson. In the next video, we'll look at the compared to method 23. The compareTo Method: hello and welcome to your advanced Java programming course. And in this video we'll be looking at the compared to method. We will be using user input, sir. Let's import the packages. And now a brief description off the compared to method. What's a compared to method does is compared to characters or strings to each other. In doing so, it takes they're asking value s key values are hidden numbers in the machine Kurd that are sound to specific characters. For example, the letter A in its lower case has the ask Eve Alley off 97 be in its lower case. Has the ask a value of 98 By comparing these two strings with a compared to method and numbers produced similar to that of deduction, Let's create a string Let one equals and a In his lower case, closer for semicolon, we create string to let two equals lower case be closed for semi colon with these two lands were then used the compared to method back story in the valley first in an integer in June , um equals late one. That's the newer case a doctor compared to let too close of a cynical Now let's see this number so you can understand how it works. Were created, simple output. We topping numb and we run our program. As you could see, the number produced is negative one. This is because lower case A is 97 low Case B is 98 97 minus 98 is negative one. So I compared to me that takes, they ask you ladies a good pace and correctly this method is more commonly used for Alfa Betar Zing daughter. What it does of the string is take the first character and compared to the first character of another stream. So if we were to have character a and character be co paid, we get negative one. But if we were to have character, a character, a would have zero. As you can see when I run the program now, what would happen if we have B in the 1st 1 and see in the sick on negative one? It compares the 1st 2 notices. They are no difference and then moves on to the sick and characters which will be in C 98 99. The value is the same. If I had to change the C to a D. We would get negative, too, as you can see an output so it can work of any length of string. In other words, we could Compean names and alphabetize them accordingly. This can be done with the following if statement first, let's erase thes two lines of year. Let's change our values from a B to John and from 82 Jack Reading create our if statement And inside the clothes will have led one Dutch compared to let to meaning. If the second string were to come late in it off a bit, then it would be less than zero and would run the code in between these two brackets, so the output would be Jack before John, so the output would be John before Jack. So let's say that system out of print land and inside the brackets we will have late one plus double quotations space, then space, plus late to after the set of brackets. Whoever else? For the other alternative, we'll copy the same line of code except adjust the values. So that way, the second name will appear for the first name, letting us know it is alphabetized in the reverse. So let's run the program and see if it works. Jacque Lynn John, which is correct. The jays are the same bets A and o different. So a comes before so alphabetize in program. It's a simple is that we all know which name comes first. Using this simple method that concludes this lesson In the next video, we'll discuss the project for the section. 24. 2nd Project Discussion: Hello and welcome to you Advanced Java programming course with Eclipse. And in this video we're discussing the project for Section one. For this project, you are to create a program where several values will be entered and you will process the daughter and output. The result. The information that will be entered in is the first name. A last name and an age. Thes values would be entertained twice. What your programmers to is ensure that the age is above 18. Otherwise the program will run again, allowing the user to enter in more appropriate daughter. Here's the example, daughter. You'll be working with Steve L. For 26. John Brava, 35. What she should induce convert these names two full caps organized by their surnames in alphabetical order and output the names as the initial the first name doctor space and inserting with the age printed beneath it. The result. Daughter will look as follows a start. Alfa 26 j dot brava 35. Here's a quick recap of what needs to be done in the program. Daughter needs to be entered off three variables. The first name a last name and a surname. If the age is 18 old below, the input is required again for the user to enter in appropriate daughter. Once you have the daughter, you need to advertise thes two names by the Sunni. This program will contain a while loop if statements user input the compared to method on the to upper case method in the next video, I'll give you, Marlon said to this program. 25. 2nd Project Answer: Hello and welcome to your advanced Java programming course with Eclipse. And in this video, I'm going to give you my on certain section one's project. First, let's create our project folder, New John Project. I'm gonna call my one sort, because that's what we'll be doing in this program. Finish we Then add our job a close to the source folder. Little city called Sort of extractive void. Main must be added. Click finish. As you know, one of the requirements for this program is used input. So we need to import the packages. Import Java, ex doctor, swing dot Stone Closer to see me, Colonel. And now we get straight into the coating. Now I'm going to show you the string variables that I'm gonna be using in this program. String if name, which would contain the first name that to use the enters, I'll get with the value of double quotations. Then my second string is s name, which will contain the surname. Then first, which will contain the name that comes first. Once Alfa protest in second, which contained the sick of name once Elba tossed and a temporary variable. What? You will see what I useful later and of course is create an integer for the age into age equals zero. Thes values will be changed as the program runs, since we have user input in this program. So our program was still running even if the user enters in garbage daughter and know that is an attack on the user. This is a competing term known as giggle JIA JIA, meaning garbage in garbage out. So in case the user enters in Bear Daughter, we can avoid bear daughter being output ID. Now let's move on to our first loop A for loop, which will run twice for into our equals. Zero. I is listening to I press plus thistles so the user enters in to sits or values the first person's name and the second person's name. Next roar. Have a while loop in the for loop, which will run until the user enters in an age above 18. So the loop will look as follows while age is less than or equal to 18 because we want the user to Indian, a value that is greater than 18 so 19 enough. So while this code is in effect, the loop or run over and over and over again until the age is greater than after 18. So let's start importing into the first string if name equals J Option Paying dot show in booked Dalia Nuck into your first name. As the message displayed Dutch to up the case, I'm adding this method at the end to save us code for the on. But this will then do is convert the user's input to the upper case. So our 1st 1 Steve, will be converted to Steve in the full caps, the source to make it easier if the user decides to intend Doctor that does not include caps. It creates uniformity in information, which is very important. You don't want out liars in your information. Next we create the same output for the last name, its name equals, and I'll just copy this line here and change your first name to your last name. And now, for the third input age, age equals into your parts and Andrzej option pain on the inside Don't show input. Die along Inter, you know, enter u h close the same me, colonel, and that is our input. So I'm looking at what we have yet is a while loop that will continue to input into these three variables until the age is greater than that of 18. Once the wild group is running, then the for loop will run again. So they use as to re enter these values. What real then do is create an if statement that will compare the names. This is where our temporary variable comes in topping If tim dot compared to Los s name. But this will then dues take the temporary variable which is sit at triples it and compared to the last name since a known name begins with three z's in his full caps, whatever the last name will be will be taking place off. But this will then do is take the asking values from the surname and adapt them from the temporary which is triples it. If the last name that the user interest does not contain four capitals ease at the beginning which would no doubt won't. The card looks as follows Tim equals s name and underneath second equals first. But know this we will have first equals if name dot Char at zero plus double quotations. Full stop space Last s name plus backslash in which will start a new one plus age close of a semi colon. Now let me go through these three loans, temporary variable will be replaced with discerning. So in our first name, we have Alfa temporary will then become l for So when the program runs again to put in the second set of Eli's brother will be compared to Alfa instead of the trip. Was it? This is so that we can alphabetize the daughter. Second equals first doesn't mean anything at the moment. But if the program runs again and the second set of values should come before the 1st 1 then these two will come in. This line of code will work out correctly and alphabetize ing the two pieces of daughter. This third line is to process the doctor. It's to give the initial as you could see when it's his charge. Zero full stop that it adds the last name starts a new land and an age the so print out 1/2 of the result that we want. And of course we need to have an else. The else is in case the second set of values comes after the first set, so else will contain the following code second, and we simply copied this Lana VM and paste it below again. This is just to process. The daughter will now have the first value at the top here in the first instance Way net. And now supposing our program works correctly, We didn't have our first name. We then have our first set of values hood into the first variable on. We have our second set of bodies put into the second variable. Now, before the program runs again, we need to make sure age equals zero again so that where the second set of daughter will actually run otherwise the while it will be skipped. And, uh, program won't work. So H equals zero close of a cynical. Now that you have completed the bulk of our occurred, we need the output. The output is a single system of print plan, and it looks as follows system apt dot print land and in sound of records will have first, Yes, backslash in to start a new one plus sickened. And that will output our daughter. That is our finished sort program. Now, let's right to see if it works, and now I'm gonna enter in daughter with age, that's below 18 or including 18 SAR crates. Full starters such as John Necks and the Age I'll Have is 15 and I'll keep doing this to see if I wild it works correctly. John Mix, 12. And now this is the third input. John next, and our program is still running the spot. The Bad Daughter, which is correct. Now let's start entering the right daughter, Steve Elson and the age of 26. And now it's into pain. John Brother, 35. And as you could see below, our doctor has printed correctly. All full starter has been ignored, and we have our initials. We have our last names wherever ages. But how do we know if the alphabetize ation has worked? Well, let's run a program again and use brother first and then Alfa. Sir John Rafa, 35. Steve Elfin, 26. And as you can see, Steve, L. For still appears at the top. So I have not only processed our daughter, but we have Alfa Beto lasted as well, but we have years full information and it's up. Put it clean and simple for the user to read. This is my on such a Section one's project. If your program contains more lines of curd than mine that are suggests going over it once more to create a more efficient program, it's better to have as little lands of code as possible. If your program works and has the same amount or less lines of code and month thing. Congratulations. You're completed. Section one's project Flying Colors that concludes this lesson in the next video. Our gives a conclusion to what you have learned in the six. 26. Introduction to Section 2 of Advanced Programming: Hello and welcome to Section two of your advance job, a programming course with Eclipse. In this section, we'll learn some essential methods to Dr Processing the substrate method and the index off method. Thes two methods are especially useful for processing strings. Inputted by the user, however, will also be using these methods to process strings that have bean scanned from a text from these methods are not exactly difficult that some practice is required to master them fully . To help you understand these two methods, it is better that you fully understand string variables character of Ebel's on the chart at method. With this knowledge backing up, learning these methods will be easy and these essential methods will no doubt help you in the future. In the next video, I'll give you an introduction to the sub string method. 27. The Substring Method: hello and welcome to your advanced Java programming course with Eclipse. And in this video I'm going to give you an introduction to the sub string method. A sub string method is used to separate a string so that where we can return a specific section off that text. For example, let's use the sentence. Strings are lines of text using the sub string method and numbers. We can decide where the string is cut and what part of the string is returned. Now that we have established that, let's look at this example Line of code. Here we have a simple system, our print line and inside the brackets, we have sentence don't sub string bracket five Close bracket. The father means that the string we cut at the fifth place in the line of text. This is where the number place system comes into play. If you wanted to cut the string from the very start, in other words, there would be no difference. We would you zero if he wanted to cut it after the first character, we would have won that. We have father in this bracket, meaning that after the first character, the string will be cut for this example. Strings or lines of text string will be cut after the fifth character meaning after in. So what we printed is GS space, our lines of text. Let's take a look at this example. I'll put an inside sentence starts sub string bracket five comma, seven close brackets. What we are doing is deciding which section off the string is cut from the very beginning to the very end, meaning we can decide at what point the string ins as well as it begins. So we have 57 We know the struggle cattle foot far. So the first character will be G. The Knicks cut off is seven and the seventh cut straight before the space, meaning What we printed is GS that concludes this. Listen, in the next video, I'll show you how to use it in eclipse as well as a few more examples to work with. 28. Substring Method Practice: Hello and welcome to your advance. Drove a programming course with Eclipse. And in this video, we're gonna practice using the sub string method. First, let's create our project. Now that we have created our project, let's import the files that we're gonna be using. We will have use it input. So it's import the Java X wing packages. Now let's start by testing out the very basic sentence that I mentioned in the previous video. First, let's create the variable string. It's called Saved. Her sentence equals strings are lands off, text close of a semi colon. Next we create an output system dot out Dr Prince Tom. And inside, we're gonna have the sub string. Makes it being used and in between the brackets ST dot sub string fast. Now when we run the program, we'll see g R lands of text. If we work on the number place system, we can work out where exactly it will cut in the string. 123 full five. So from G on woods. So our program of sub string is working correctly. Now let's go a step further and we're going to cut the lawn at a specific point let's say 10. So we will carry on working from the That's 12345 It should end off at our. So we run the program. We get our and notice when I select the land. There is no space after, so it does cut before, not after the 10th place. Now that's work of user input. Let's take away in this line of you here and great our import dialog J option pain show input, dialogue and inside the message box enter a sentence. Doing so will bring a fundamental floor to the table. When I run the program, you'll notice an era the index out of bounds exception, meaning that the string that we're trying to divide cannot be divided with the set parameters. In other words, there's 10 does not fit into the string. I entered Hello. A string of five characters cannot be cut at the 10th place, so it is out of bounds when the user enters any doctor that doesn't fit our code errors come about. Of course, Aiken temporarily remedy this by changing the values to like one and two instead of five and 10. So when I run the program and are talking Hello, it works. Of course, this cannot always be solved. A user can also inter only one letter, for example, A. And then we have another out of bounds exception. And again we contrive remediate. But it's all temporary if they use the decides to enter and nothing. So when I run, the program operates. Okay, one small. We get index out of bounds exception. It can't cut something that isn't the errors such as this can be easily solved. You can create an if statement where nothing gets cuts until the user enters in, something that is long enough to fit the parameters. Or you can create a while constantly asking the user until they eventually enter something that fits the parameters. Or you can use the length method and few meth functions to figure out exactly where you want to cut things. But all comes down to one simple problem. What if you want to cut something specific, we cannot rely alone on the user intern in just the right length of daughter. How do we create a program that scans this text before we use sub string to cut it an extract daughter? That's where the index off method comes in. That concludes this. Listen next failure, I'll give a brief introduction to the index off. 29. Introduction to the indexOf Method: hello and welcome to your advanced Java programming course with Eclipse. And in this video we're gonna be discussing the index off and lost index off methods. Thean Dicks of methods are forms of scanners that could be used to scan through text and find specific characters or strings. The index often last index off method return an integer that integer refers to the place in which the character or string is located in the text. Let's look at this example sentence. This is a random sentence off the following code into temp equals sentence dot index off are in single quotations because it is a character. The result that will be output ID if you put into the temp variable is 10. This is because, according to the number place system, the letters start zero and move up our force in the 10th place. This are being the are for random in This is a random sentence, and as I mentioned before, this will also work of string variables. So here's an updated version of the code. This time we're looking for a word random, so we use double quotations because it is a string you find the result is still tin. This is because the word is located starting at the 10th place in the string. That is the index off method, which scans from left to right the last index off scans from right to left, meaning If you want the last instance of a character or word, we would use the last index off. For example, what if you wanted to locate where the last word was in a sentence? Well, what you would do is use the lost index off and the character wild space, and it will locate the last instance of what space and a string meaning by adding one. You can then find the place of the first letter to the last word Couple in these two methods with sub string method can help you scan strings and extract daughter. So if you're looking for a specific word in these other methods to use, that concludes this lesson in the next video, we'll practice using the index off the Lost Index, self and the sub string methods together 30. indexOf Practice: hello and welcome to your advanced Java programming course with Eclipse. And in this video, we're gonna practice using the index off methods with the sub string method. First, let's create our project for this project. We don't have user input. We are just gonna practice with normal strings that we create ourselves. So there's no need to import any outside packages. Let's go straight to coding and create a sentence for us to work with. String sent equals double quotations. And let's use this is a random sentence close of the same Yucatan. Now let's practice using the index off method alone before we move to the other two. Let's find the first instance off s. We'll have to, of course, our put our valley don't out front land and inside it will use the method dot index off and in single quotation marks its So that sent dot index off and it aside is and we run up her again. Universite prints the number three. This is because the number place system starts at zero. So t would be zero h would be one. I would be to their full. This is three. Of course the same would apply for you to use the chart at method, which is self explanatory. So we take out, index off and try char at every top in three. I'm only playing the program. You notice we now have s so index off method is working perfectly. Now let's move on to the last tunics off. So we take away our char it and let's say we want to find the lost index off. See lost index single quotation marks. Seen you notice we get the value 23. How can we make sure that this is great or to save us time from counting How many letters they are in the sentence were just top incentive of length knowledge. We have written that coat. Will you run the program? We have 25 so that's 25 characters and as you know, it starts at zero. Therefore, 0 to 24 c is the second lost, which makes a 23 which is correcting our method Lost index. All is working correctly. Now let's move on to combining these two methods with the substrate method. Let's say we want to take out a specific word from the sentence. What were then used is our substrate method sub string. Then we would use the index off. So that sent index off and the specific would, let's say random So we would use double quotations for and, um and now we want to just cut out the rest, which is the space and then sentence so we would have comma on. What we would then do is copy the lantern sent dot index off, paste it into the following space, and we would add, however many characters they are, so there are six characters in random, so we'll add six. Now, when we run the program, it prints the word random and you'll notice that there's no space after random where exclusively cut out the word, extracting it from the sentence and I'll put it in the output box below those of the index off methods and how to use them of substrate to scan strings and extract. Daughter That concludes this. Listen. In the next video, we'll discuss the project for the section 31. 3rd Project Discussion: Hello and welcome to your advance Java programming course with Eclipse. And in this video, we're going to discuss the project for Section two. For this project, you are going to be using the methods index off loss index off and sub string. What you need to do is ask the user to enter in the first middle and last name all in one string. You're then to divide these three words into three different variables. First, middle and last, and then you are toe up. Put them as follows. You will have the first name colon and then the first name, and then you'll do the same for middle and last name beneath each other. Once you have printed all three names in the following way, you're then to output on the last line. The first name, then there second name initial full stop space and then their last name. So, for example, we have the entry Joe Henry blog's to be output. It is first Kerlon, Joe Middle Colon Henry last curl on blog's and then beneath it, Joe H dot blog's. This is your project for the section. You'll also need to be using a method that he learned in the previous section. However, a couple of thes three methods it should prove no problem in the next video, I'll give you my answer to this sections project. 32. 3rd Project Answer: Hello and welcome to your advanced Java programming course with Eclipse. And in this video I'm gonna give you my answer to Section two's project. First, let's create the Project folder, New Java Project. I did not specify what you should name. No Java project. So it is up to you to decide I'm not Kuhlmann name process because we wouldn't be processing a name in Click Finish Now that we have created Project, let's create our main clause. Our drop down right click consoles new class, and we're gonna call it name Process as well, and we want to add the main mated as specified in the project discussion. We will be using user input, so let's import the packages. Import Java X, not swing dot star close of a semicolon. Now let's first start by creating a variable which will contain the user's names so string names equals J Option Hang Dr Show input dialogue and it's our double quotations into your first middle and last name close with semi coat on. Now that we have created that variable, let's move on to story in values into the three variables I'm aged before a variable for the first last and middle name first, let's create one for the first name String. Let's go to first equals we're topping names, not sub string. And since the first name will appear on the first line, we will have to start from zero with our sub string, and we'll have to do it until the first white space names don't index off and in brackets, single quotations space, close it and semicolon That should take the first portion off the name out. We then create a string for the middle name String Middle equals names. Don't sub String inside now names the index off single quotations space, and we're gonna add one. So that's where we can get the first character after the wide space, not including the white space. Once you have done that, we then Atacama names not lost index off and inside want space. This is referring to the space between the middle and then last name. Close off a cynical Now let's move on to the last name. String last equals names dot sub string and, as before, we'll have names. Don't last index off instead of index off Want space plus one close of a senior Come on. We don't need to add in a second perimeter because the lost name is at the end, and that's the piece that we want. That should store are three names into the three variables. And now let's out. Put it as follows system Don't out front on a first. Come on space close plus first. And now, instead of creating several system our print plump, I'm going to show you a short cut that starts a new land inside a single system. Our print plus to continue. And the shortcut is back slash in which starts a new land. All that appears in between the double quotations. It won't appear when printed, so we're gonna rot as if it isn't thing. Don't call on Space Way had the middle name plus explosion last colon space plus lost. Now we've created the first part of the output. Since we're saving loans, let's create the next part in the same system. Our print land plus backslash in bless fished space us the middle shar at zero place, double quotations, full stop space and let's add the last name lost. And there we have up put in a single output land Now we When you run the program, we'll be asked to interning. Let's use the example name that I mentioned before in the previous video. Joe Henry Blocks and Click. OK, and there we have the complete output First Joe Middle Henry Last blog's and we have chose H blocks, I specified. As you can notice, the program is becoming more compressed. There's more code in a single land that is before. It's what creates more efficient programs. In a sense, less code is better. Not always, but most of the time it is. But in the long run, if I'm writing hundreds of lines of code, then this will make it easier for me to find the output. Of course, if you work in multiple programmers, you can add your comments to specify away. Everything is, for example, to forward slashes. And I would say this is where the very bulls are, or another to Ford's lashes above the output. And I'll say, I put So this program is excellent practice for creating thes compressed lines of code as well as dividing sections and organizing them, making them efficient for other programmers to look at as well as you This is my own certain section to his project. I hope you find it useful. That concludes. His lesson in the next video are conclude Section two. 33. Conclusion to Section 2: and that concludes Section two to your advance. Job programming goes with Eclipse. In this section, you learned three important methods. The index off lost index off and sub string methods. Learning these methods have taught you the basic principle of scanning. Searching for specific daughter in text files is very important, and with these concepts in mind, it'll make learning proper scanners in the future sections much easier. These methods are very useful for processing daughter, but it's scanning works. Justus well, as any other scanner that we will be learning, therefore, is essential that you keep these methods and mind in our future sections. Congratulations and coming this far on the course, and I'll see you in the next section. 34. Introduction to Section 3: welcome to section three of your advance Java programming course with Eclipse in this section, we're going to learn how to create objects from the scanner and print rotter class. We're gonna use the scan a class to scan ready made text files and process daughter the print rata closs we're gonna use to rot to text files. Now, keep this point in mind. The scanner is very important to our Opie studies. Scanning text files to extract daughter is very important And programming how we're gonna study object orientated programming is to create miniature programs. One of them is a program that's gonna consist of the scanner and using these to advance pieces of code, we will advance our studies in Java programming. For now, the scanner has nothing to do with a P. We're going to create a basic scanner in our main method and use it to read text files and other streaks. The scanner close contains various methods that we used to read text files. You will learn about these methods in this section as we progress towards object orientated programming. These lessons have become more complex and harder to comprehend. However, if you take your time and practice What you have learned. Object orientated programming shall prove no hassle. In the next video, I'll give you an introduction to the scanner. 35. The Scanner: Hello and welcome to advance Job. A programming course with Eclipse. And in this video, we're gonna be discussing the scanner first. You need to understand the hierarchy behind the scanner. There are three stages to this hierarchy. We have a close in this case, a scanner close. Then we have an object on object. Contains methods which are small programs. The very smith. It's off the scan. A clause that we are gonna be learning. Help us scan through text searching for specific doctor tops. Here are some of the scanning methods that we're gonna be using. We have the doc next method, the next integer, the next double and next billing. The next finds the next string the next inter funds, the next integer. And as you can guess for the other two next double funds, the next double and Experian plants next building. These methods have a memory. In other words, it will ignore any previous discoveries. If you were to use the method again, For example, if we have a string containing two words if we were to use next the first time, it will get the first word. However, if we used a second time it will find the second. Would this memory and the combination of these methods will help us scan through large text files with ease. And don't worry, you will learn about them properly in the next video. The benefit about these methods is there automatically convert whatever doctor Top is searching for. So if you're scanning a string and you want to get an interview out of it, the next end made that will convert that integer so you can happily store it in an indigent variable. Before we can use all these methods, we have to first create a scanner to create a scanner. There are several steps one US import the required packages. Two. You must create the scanner object. The scanner object creation could looks as follows. You will have scanner calling the scanner close a salon. This is the most common name for scanning. A line of text equals new scanner, and in the brackets you'll have the string or text file that you'll be scanning. Of course, it is good practice to always close your scanners once you're done of them. This being so that way. If you were to use the scanner again, it would re fresh ignoring everything that it discovered before and starting over. Of course, this isn't necessary, but for longer and much more complex programs, you must keep in mind to close your scanner to close your scanner, you top in the following code. A salon name of your scanner dot close double brackets close of a semi colon. How does the scanner separate variables from a string? It uses what is known as a delimit er it. The limiter is a single character that separates values inside a string. For example, in a sentence, we have spaces between our words. These spaces are the default a limiter, the delimit er off white space, which is the default or automatically separate thes valleys into what is known as tokens. So these words become tokens in the scanners honors, and when you use your method, it converts these tokens through the desired variable. However, your delimit er can be changed as some daughter isn't always separated with a wide space. We'll do this in a later video that concludes this. Listen. In the next video, we'll practice using the scanner 36. Scanner Practice: hello and welcome to Advanced Java programming course with Eclipse. And in this video, we're gonna practice using the scanner object. First, let's create art project. Now that we have great at our project, let's import the packages that will be using the scanner requires the utility package import java dot util dot stone. This will direct the package straight to our program so we can use the scanner with no eras . I'm gonna show you all for basic methods before I move on to some more advanced scanner practice. To use these methods, we need to have a string to skin. So string line equals. And in between, these double quotations are have four different doctor tops. Hello being the string 40 being an integer 2.5 being a double and true being a building and clothes of a semicolon. Now that we have done that, where you're going to create the scanner object and we're going to give it the string to scan to do so, we will create online scana. A salon will be the name of our skin object equals new scanner. And in between these briquettes, we'll have the string that we're gonna be scanning, which is lunch and then we close for semicolon. Now that we've done that, we're gonna create four variables to contain these values Serving. Let's start with the string variable. First string would equals a salon. And to get a string we use next nothing. And so the brackets and we closed a semi coat on. Next we do the same thing with the intelligence int num equals a salon dot Next int brackets close ofhis Emiko that will get the next integer being 14. Now we do the double Denham equals a salon that next double closer to Simic on and for the building as well be lean test equals a salon dot next building. Now we are done using a scanner and as is the common practice, we must close it a salon dot clothes records and a semicolon. And now, of course, we need to have an output to see if our values are being properly stored. A great system, our problem, and inside the brackets will print out each one started a new line as we go would number Denham and test. Now that we have done that, we were on our program to see if prints out the valleys and it does indeed way have all string. We have a introgen double. And of course, our building submitted their working correctly. And scanner is scared industry for the next part of this. Listen, I'm gonna create a small program where the user has to enter in the first name, last name age on the same land. And we're gonna be using our scanner to get those values first, the to raise everything up to the creation of the scanner. Next, we import our job X swing package. So I use I can't inter in the values. Now that you have done that, we create a J option pain. They import dialogue into a full name and age. Now that we've done that, let's create some variables to contain these values. So let's create one for the first name. We use a salon next as before to get the string. But now there's a second stream. As you know, the scanner does have a memory, so it will ignore the previous string and get the next one so atop in string. Last equals a salon dot Next, Was that any feel of it picking the first name again. And, of course, an end in DUM equals Salam. Not next. We now close our scanner, having scanned the string, and we are put it, we'll print the first name, start a new land in the last, another new lamb and then the age. Let's run the program and I'm gonna enter in the example value both Joe Blog's 25. And as you can see, it has worked correctly. The Skinner had ignored the first string value, having a really scan it and placed it in a variable and scan the next one and done the same . And, of course, the individual work. Justus. Well as it did previously. This is how I use a scanner to scan a string that concludes this. Listen. In the next video, we'll learn how to change D limiters and deal with basic errors. 37. Delimiters and Basic Error: hello and welcome to your advanced Java programming course with Eclipse. And in this video, we're gonna practice change in de limiters and dealing with basic era notice. I have created this basic scanner program, which, when run, displays the wood number and integer 45 beneath it. A fairly simple program. But what happens if I change the land? String two number hashtag 45. When I run the program, you know just in error appears showing the value no such element exception. This area is here because there is no value in the following land that corresponds with a string or interject, meaning that the lands a seal our necks and S Ellen next and can't find a string or interject to store into the variables. This is because the following information hasn't been split into tokens by the what space The default. The limit of the scanner is no longer plant to the string because there is no deal imitating news. Some daughter does require wild space. So in these large text files or several other ways, you can store daughter things. Use a different delimit er than a wide space being that some daughter that's being used requires a wide space not to be separated, but as part of the information What we have years. An example of daughter that's been separated by hashtag. So what we need to do to extract the daughter is change. Org limiter. So let's change our deal emitter in this program. To do so, we go to our scanner creation lamb, and we add the following to the end. Don't use the limiter and inside brackets, double quotations and the character that you want to be using as your delimited. So let's run our program here, and it works just as it did before. Now let's deal with the basic error that you're encounter. Using a scanner, you'll have to scan through large text files, and more often than not, you won't know how much daughter there is. So you wanna scared all the daughter and process everything into information, but you can't create several hundreds of lands depending on how long this text follow is or how much daughter is to scan. You're then have to create a loop, a loop that are run over and over again, but stop itself when it has reached the end of the daughter. There is no method to figure out the exact length of your daughter, so we use a special method that will return a billing, which we can then use to create a while. Loop, which will run through Datta until all the information has been scanned and processed. Let's create this wildly the while loop will be below the scanner so way have to stop in the following. While an insider close, we will have a salon calling the scanner anywhere. Top in DOT has next. This will take a look at the scanner's memory and see after scanning through the entire doctor if there's anything left to scan. If not, it'll return False and the while. Loop Poland Now using this lan, let's create new code to work with a new program that we're gonna use to count how many words are interred in a string. First, let's remove our output, and the Masons used not to create this program. Let's create a counter int count equals zero, and in Santa while it was use, it can't plus plus. And now, to measure how many words on the slum top in string, temp equals a salon that next now that we have done that, let's create an output for the Count Favell print count. And finally, let's adjust our land So we have something to work with. Relieves the deal emitters hashtag for now and create several words in the sentence. Such his number. John hashtag taste hashtag sentence. So we have four words in this London. Now let's use our program. When we run, it prints the value of form, so we know our program is working correctly. Not only is the wild ending once it has nothing left to skin, but it is scanning everything and not excluding any daughter. So what we have now is a simple program that we can use to measure how many words a user has entered all at the same time learning how to change the limiter and deal with this basic era that concludes this lesson. In the next video, I'll give you an introduction to file reading 38. File Reading Introduction: hello and welcome to advance Java programming course with Eclipse. And in this video, I'm gonna discuss how you can use a scanner to read a text phone. What we're gonna do is create what is known as a file scanner, which will work hand in hand with what we've been using up to now, which is known as a non scanner. The file scanner reads the daughter from a text phone while the LAN scanner scans each individual land off the text phone. Thes two will work hand in hand, so I'll show you how to link them up properly. The code for creating the land scanner is as faras scanner SC file equals new scanner open brackets, new file open brackets again and the name of your text well in double quotations such as text Doc Txt and the new clothes your records and ended for Simic alone to make sure that this program work in you to ensure that there's a valid text file and you're project folder . As to what text foul and way the project folder is, I will show you this in the next video to scan the lands from the text file will use a combination of what we've learned in the last video with the file scanner. First we create a while loop and in the clothes will have that has next method being used with the S E file. Inside the program, we will have a string of land and top in the following method below s e file dot Next lunch which will take the next line in the text fall and place it in a string variable. And now that we have a string variable or for line of text, we can start using our S Ilan scanner. When it comes to far reading, you'll have to close your A salon scanner inside the wild. This is because you are not reading a lot of text. You are reading a file. Therefore, the only thing that needs to be closed after the wildlife is the SC file scanner that concludes this. Listen, in the next video, I'll show you weigh and how to place your text file in the right project folder so we can use our file scanner 39. File Reading Preparation: Hello and welcome to Advanced Java programming course. And in this video, I'm going to give you the preparation instructions to creating a foul reading scanner. First, let's create a project. I'm gonna call this one file Reda practice. Once we have done that, let's create our main class new class. Call it the exact same name. Foul breeder practice. Create our main method and click finish before we even start coding. We need to have a text file to read. Now I'm gonna show you way to find it. When it comes to working with Eclipse. A text file that we're gonna be using is the names Doc txt file, which I have really copied. Once you have copied your text found you needed fund your clips. Workspace folders as follows. Go to your system. See draft. Go to users. Go to your user. Profound ing and fund eclipse workspace. This is where all your project folders are contained. Once inside your clips workspace, you'll be presented with many folders. These are, as you can see, the names of our projects. The one that we're gonna be using for our next program is file Read a practice. So it click it and go inside. And this is where we place our text. Far right click paste. And now we have our text fell, which we're gonna read. Here's a look at the information that we're gonna be scanning. And that is all the preparation you need before you can start coding your file scanner that concludes this. Listen, in the next video, we're gonna practice using the file scanner. 40. File Reading Practice: hello and welcome to advance Java programming course with Eclipse. And in this video, I'm gonna show you how to read it. Text fell using a file scanner before begin. There are two things we need to do. First, we need to import the packages that we're gonna be using. So go via and we import the utilities package java dot You till don't still and we import the Iot package, which we're gonna be using for file reader import. Gina, not I o Don't start close of a semi colon diesel the packages that we need. Second, we need to deal with an era that appears if you do not include this close when you use a file scanner, your program automatically assumes that it might not be they. In which case, it also an era saying it isn't when however it is as we have done so in the previous video . How we bar pauses era is either with the try and catch statement which we will learn later or with this quick way we can deal with the era we go to up have ecstatic void main after dogs with top in the following throws file not found exception. We've done all the preparation we need to read a file. Let's create our file scanner way top in the following scanner they see file equals new scanner inside brackets, New file and inside another set of briquettes, double quotations names. Not T. Eckstine, The name of our text close of the semi colonel. Now let's create the variables, which will be story in values. In first, let's take another look at the text fall. You'll notice we have three tops of information here. Way. Have a first name, a last name and an age, so we will need three variables to stall these values in. We do this as follows a string, and while we creating variables, let's great one for alarm. String Lon equals double quotations. Come in first equals double quotations and sickened equally in the same. Then we creates an integer for age. Int H equals zero. Now that we have variables to store our values ing, let's move straight on to our program. Let's move straight on to the wild while is he found that has next and inside the brackets Lon equals C found not next, none close of a semi colon Then we create a scanner which will read this land skinning a salon equals new scanner lan. And as we saw in the text file, everything is separated off a hashtag. So we changed the deal emitter accordingly. Now that we have done that, let's start by destroying our values into variables. This will be done as follows. First equals is Helan dot next, which will get the first name. Second equals s sealant not next and finally age equals a salon next and those are varies were done using the land scanner. So we close it immediately for the memory to be refreshed and used for the next line. I said, Don't close record cynical And now let's put our daughter in some way. Let's do this in the wild as we go instead of storing this into a larger variable. So system out the prince lamb and let's print the initial for the first name than the rods name and then the age. So that's first got char it zero plus full stop space class. Second, less space plus age, and that will be our output for this program. And of course, we need to close our file scanner, which will do outside the world s C fun. Don't close brackets close of a semi cut off and that is our program. Now when we run our program, we should see on daughter printed out as information. And it is indeed we have. Our initials are lost names and our ages. So our program is working correctly. And that is how you read a text file with a file Skinner that concludes this lesson in the next video. I'll give you an introduction to the print Terata. 41. PrintWriter Introduction: Hello and welcome to you Advance Java programming course. And in this video, we are going to be discussing the print Terata. The print rata is an infinitely useful piece of code, and in structure it is similar to a scanner. We use the print writer to write your text foul to create a print writer is as follows Utah Print Rata Capital P and W Name of you Print Trotta equals new print Terata brackets, new file writer and sad. Another set of brackets text doc, txt or whatever takes foul that you're writing to Gerard To text phone. You use a simple print line, but instead of system dot out, we use the name off the French writer. There was common name for print. Rata is at file, so we would use out file dot print lan and inside the brackets. Whatever we'd like to print to the text file and lark a scanner, the print writer needs to be closed to close. The Prince writer is as follows the name of the print trata dot close double brackets cynical similar to that of the skin of the print, Rata Osa has a basic era while file scanner uses the file not found. Exception. Flaws. The print writer uses the Iot exception clause. It should be noted that there's an addition that you could do to the print writer once the print writer is closed when it is used again, it will override any daughter inside the text found. So to make sure that no daughters have written, you can continue where you left off by adding this piece of code to a print rata creation to persistently right to text phone. The line is the exact same, except inside the brackets where the text dot txt is contained. You had a comma after the text file and rot in true. There's true signifies that you wish to continue where you lived. Or so if you wanna constantly build up Dr Into a single text file, you would use this little amendment. I'll provide you for text file that you'll be using to practice with in the next video that concludes this lesson and the next video. We'll practice using the print writer with a text file that I'll provide you 42. PrintWriter Practice: Hello and welcome to advance Java programming course with Eclipse. And in this video, we're gonna practice using the print Terata Before we begin, you must go through the following checklist to ensure that you have everything you need to begin. Koerting first. Great. Your program. I have Goldman Prince practice. Once you have done that, import the three packages that will be using finally copy and paste. The takes far are provided you printing dot txt in your projects folder. Once you have done all three steps, you're ready to begin this. Listen, now that you have done that, let's throw the exception like we did for the file not found Exception. We go to our public static void Main after the dogs Brecher Tweet Top in throws I o exception. This piece of code will bypass the era that the program will throw if you're takes Found is not being now that we have done that, let's great out! Print writer that's created as follows Print Bryant and we're going to call it out. File equals new print writer Inside the brackets New file writer and inside the other sit who have printing Doc Txt. Now we have created our print rotter object. Let's use it of one simple message after file. Print Ellen with one simple line. Hello will Close of cynical, Another tree done using the print writer. We close it as well. Art file, but close record. Cynical. And that's how I started the program. Now let's take a look at our text fall. As you could see, it's enough projects folder. We double click, and we noticed that all that is is test text. However, when we run our program and we check out text file announces, Hello World Halprin Trotter object has over returned the test text and printed allow that we wanted Hello World. And just like that, we have a working print writer. This is a very basic print trata, but let's go further to include user input. To do so, we were to create a dialogue we have to create a while, which will run until the user enters in stock. Each text that the user enters is immediately printed to the printing dot txt file, so let's start by first erasing this land and creating our temporary variable with a usable store. Their input strength Tim equals J option pain, not show input, dialogue into a sentence type stuff. Do stuff. And that will be our entry, we know. Create a while. Loop. Well, Tim is not equal to stop out file dot print Alan Tim. And to keep the entries going, we'll copy the land above not inclusive off string, because we have created the variable Really another to have done that. Let's run out program top in a sentence. This is a sentence. However, if we keep entering in values, this is another sentence and then we eventually stop when we check our text file and then we check out text phone and we'll notice all our values. Are they? This is a sentence. This is another sentence. Everything we have written in the dialogue has been printed. Of course, when we run the program again and into in another value and then we stopped, we go back to our text found and notice All our daughter from before has been removed, so we don't want the use that you lose their daughter. We'll have to make the printing text file true. So we go back at a comma after the double quotations in the print Robotic creation and talking true. Let's top in her alone world. How, uh, you and then we stop. We go back to our program and we go back to our text home. We noticed that it has been added onto another value. This is because we have made it true so we can persistently add to the text. And that is the print writer that concludes this lesson. In the next video, we'll learn how to use a try and catch statement. 43. The Try and Catch Statement: Hello and welcome to your advanced Java programming course with Eclipse. And in this listen, we're gonna learn about the try and catch statement. The trying catch statement is a very useful statement, which we can use to customers are error messages to create a try and catch. Let's use this program that we've created before the file reader practice Notice that we have the following era above year. Throws file, not found. Exception. What we're gonna do is remove this land and create a personalized try and catch for our scanner over here. So let's begin by first creating the trial part. Try and catch looks as follows. Try and then we create our brackets. We all now drag our code inside here. Indented search. Wade remains organized. And now that we have pasted our code inside the try, we must create the catch catch. We open up our brackets and what we're gonna do is put the file not found exception era inside these brackets. What we do is top in the era file, not found exception. I'm going to give it a name, but such as e once you have done metric rate a sick and set of brackets notice our code is now being recognized and is now going to run properly. We're now going to create an error message, which will be displayed. For example, System don't out dot Prince von and I'm a siege could be anything such as It's old broken like an hour Remove throw. It was found that found exception and run out program. When we run a program, it works just as it did before with no errors. But supposing we were to remove the text file to see what our era would be. So we go to our Project folder, delete the text farm. Now women go back to our program and run it. It now displays our customers there a message. It's old broken. Try and catch allows you to be professional with your code when writing long, complex sections of code. What we want to do is customers are air messages to display which land our errors can be found. For example, are Kurt begins on the 12th Land so we can mention that in our air message and sane which section or what? The problem is for the section, so more professional error message would look as follows File not found. Full scanner learn 12. So we're on our program. We know exactly where to find the code as well as what kind of problem we're encountering that concludes this lesson. In the next video, we'll be discussing the project for this section. 44. 4th Project Discussion: Hello and welcome to your advance job. A programming course with Eclipse. And in this video, we're going to discuss the project for Section three. For this section, you are to create a rather large program. I'll provide. You have to text falls marks dot txt and results dot txt. What you're to do is create a project called test Results. Place both text files into the Project folder Greater program that reads Mark start TXT processes the daughter and information and prince the results to results. Txt. You are to do this by using the file scanner, SC file Aylon scanner, a sea lion and a print rotter out file. The doctor you are to process is as follows. Joe hashtag blocks hashtag 56.7 hash tag. True, this is only one line of the daughter you'll be processing, so you'll need a loop through the entire file. What you are to process the daughter to become is the initial of the first name. The surname, the names being the name of student, the percentage being what they got on a test and the jewel fills being whether they passed or not. And to avoid era, you're to place your main program in a try and catch statement, you might be aware that there are two areas that you encounter. The file not found exception and the Iot exception. All that you need to do is add a second catch to the try and catch statement, including the second era during so also help you decide which errors that need to be displayed in each catch. That concludes this discussion in the next video AL Provider of March answer to this project. 45. 4th Project Answer: hello and welcome to advance Java programming course with Eclipse. And in this video, I'm going to give you my answer to section threes Project. As you can see, our great, um, a project test results. And if we go to the test results folder, you will see that I have placed both text files inside and checking the text files. We have marks containing our daughter, and we have results, which is blank left. Wants to print to a now back to our program. We're gonna import our packages and start coding packages will be using Are the utilities and I o package. So import java dot you till dot star close of his cynical on import java dot io dot star enclosed in a semi colon. And those are the packages will be using. Next, we'll create the try and catch statement in which we will place our code trying and after try, I'm gonna great catch. And inside the clause file not found. Exception e and brackets, which will contain an air message as follows system. Don't out Prince Alan. And inside the brackets file not found. File scanner. You'll notice that file not found. Exception is underlined in red because right at the moment we don't have a scanner that scanning for file. This will change as we progress and there is no better way to progress than start coding our main program. Well, first start with the scanner creation SCANA SC far equals new scanner Inside the brackets, new file and another sit, we will name our text foul, which is the marks txt. As you notice, we've created our scanner and the era message has disappeared. So our program now sees the scanner and we can continue coating without fear, often era when we were on the program. Next we create the while loop which will run through the text phone while a C file dot has next and inside the brackets will create a string variable string Lon equals a C file dot Next lan close of Simic alone and then we create online scanner to scan through the string scanner Salon equals new scanner plan and we have to change the deal emitter to suit the doctor which at the moment is separated by hashtag. So don't use limiter cash. Now let's take a look at our daughter once more you notice there are full values off three tops. We have two strings. The first name and assuming we have a double, which represents the percentage that the students got on their tests. And we have true or falls depending on the percentage whether they passed or not. So we will need to string variables a double and a billing returning to a program that's coders in now string first equals s ilan dot Next close of the semi colon. This will get the first name. Well, then do the same for the last name. Next week creates a double double mark equals a C lan. Don't next a sea lion not next double closer to see me, Colonel. We then create a building for whether they passed or not Grilling us equals X C alum Next good close with a cynical we are now done with the A C Land scanner. So a salon dot clothes and after the while loop will be done with the file Skinner. So we add this See file Don't close records cynical on a thin. Now we need a code a print Terata which rots the results to the results Fuller. The print rata will also be in the while loop we create print Trotta out File equals new print writer New file Roger and inside this set of brackets real name I'll results dot txt farm and close with semi colon You notice there is an error right now. This is because we need to create a sick and catch for this era. So we add catch again and inside the clothes top Io exception and let's give it a different name, such as if and another set of brackets and an error message customized to the print Trotta system out of print lan file not found full print writer and the era is gone. Now we can continue in confidence with the print rata code continuing where we left off, we will need to add true to the end of print Trotta as follows This being so that we have this further textiles to scan there will be printed out to the results to file and the old daughter won't be over written now that we've done yet. Let's create an output to this text file out file dot print lan and inside instead of brackets, we're gonna process the daughter and inside the brackets. We want to process the daughter as we output it. As you know, we need the initial of the first name sets first dot char at zero. Add a dot and a space after then we had the last name and we add another space to go in. Between that and the percentage which is as follows mark and finally another space, whether they passed on up, so that would be pass close the semi colon. And that is our upward line. We are now done using our print writer, so we close it out, file dark clothes, a set of brackets, close a semi colon, and that is our program, one that scans the text farm processes the daughter and I puts it to the results text from . So let's return to our text phones. We see our role daughter. We see a blank ticks from when we go back to our program and run it. It says it's finished writing. We go back to our text files and we check results again to see our process daughter. And this is Mark on Searches Section threes project. If you're programmed as what mine does in the same amount or lace lands of code. Think congratulations. You passed this test with flying colors. If you struggled with this test boy off program didn't work as planned. And I suggest looking over the section once more before continuing to section for this is only one way you can answer the project and there are no doubt better ways in what you concurred. This program that concludes this lesson in the next video are provide a brief summary of what you've learned this section. 46. Conclusion to Section 3: and that concludes Section three of your Vons Java programming course with Eclipse. In this section, you not only learned how to use the scanner a valuable tool for scanning strings, but you learned how to use it to read from text files receiving daughters one of the most important steps one can take before you can start processing daughter and turning it into information for their own. You learned Todd A. Rod to text falls after processing the daughter distorted in a text file, which could be later read with ease instead of going through the raw daughter, he goes without saying that grating and storing information is vitally important in the arty world. You're now at the point. Were you creating larger and more complex programs all on your own, using advanced methods that you've learned in this course in the section I gave you very little ad vast and tips on your project, leaving you to create this program on your own and doing so. You've learned a bit of independency when it comes to programming, which is important when you receive your own projects. When working with a team next to sections won't be any easier, But if you keep a cool head and practice what you learned your sore through to the end off Opie knowing much more, then you did when you began the schools. Congratulations. And I'll see you in section four. 47. Introduction to Section 4: hello and welcome to Section four of your Advanced Java programming course. With Eclipse in this section, we are going to learn about a new, very built up known as a raise as well as the split method, which is very important when working with a raise and large amounts of daughter arrays, a special variables that can hold more than one value on one specific top. For example, you can have string arrays and into Juries. They're gonna hold several values. In one arrays can have infinite amount of dimensions. For example, one dimensional rate can be considered as a row of values. A two dimensional array can be considered a table, ones with rows and columns. And then you have three dimensional raise, which are like several layers of tables in this course, will be dealing with one dimensional and two dimensional race being that three dimensional rays are far more complex and require a section of practice on their own. The split method is a form of scanner and substance. It is used to separate tokens in a string. That split method works well within a range usually used to split values and place them in a Narain. In the next video, I'll give you an introduction to one dimensional and two dimensional raise 48. Arrays Introduction: Hello and welcome to your advance Java programming course with Eclipse. And in this video I am going to introduce you to a raise a raise, our variables that can hold a specified amount of values, meaning you can decide how Maney values end of what top an array can hold to create an array Isas follows. Here's an example of an inter parade and how to create on way topping int the top of the array that we want. We give the name to the array and what specifies it as an array are these square brackets over here? The first sit contained Nothing you didn't say equals new int. And inside another city square brackets, you specify how many places there are in the array to print a very from a specific place. You would help in the variables name, squib, record and a number which represents the place in the arrange. For this example, we have a 10 value into array. It should be noted that the number system also takes place in a raise, meaning it starts from zero. So for 10 value re it zero to not in the place system. This is a one dimensional rain, which can be represented by a row or values. Next, we have a two dimensional array. A two dimensional rate is created in a similar way. Here is an example, often interject two dimensional rain and two are being the name of the rain. And in these two sets of square brackets were far aunt. In the first set of square brackets are the rose off a two dimensional rain. Second, set our columns. So in the first set of Breck, it's you decide which row you're gonna be working with and then similar to a one dimensional ray. Your second sit. Besides, the place in the road to Asan Valleys and print values is no different just with square brackets. In addition, to specify the place in the rain, for example, to our square bracket, zero Scream rec zero equals 56. We have a sound of value to the very first place in the two dimensional array. For this example, venerate, we had five and 10 as a specified length or values. In other words, we have created a variable that can contain 50 values that concludes this lesson, and the next video we'll practice using a one dimensional arrange 49. One-Dimensional Array Practice: hello and welcome to advance Java programming course with Eclipse. And in this video, we're gonna practice using a one dimensional rain. We will be using user input in this program. So be sure to import the swing packages. Input X, don't swing. Don't store close of the cynical. Now that we have done that, let's get straight into creating an array to store values in. We're gonna create an integer array that will hold far valleys and a r to name it. We had square brackets. So the program knows we're creating a into jury equals new int. And in the second set of square records were put far the showing that the rate could hold far values. Next we'll create a full loop which will run far terms, allowing us the user to enter in five different images. The for loop will look is funnies for into I equals zero. We have an equal zero because we're gonna be using this are very later on. I is less than some I class. Plus we then created sit brackets and now we create the land of code at all store values into the array ale arm. This is where we use I being that arrays start at the very of zero, so we have to start at zero place to save us. Kurt, we won't create another interject counter. We'll just use the I in the poor close So our I equals into Do Not Pass Shea option pain show input, dialogue and inside a set of double quotations. Enter a number close of a cynical, and that's all we need to store values into our ray. Next, we just after print come to do this will create a simple output system out of print A on R and break. It's this program we creating is fairly redundant when we can simply just print the values that we enter straightaway. We needn't use an array but a separate variable. To do this, we simply create another fuller with a similar Krul's into J equals zero. Okay is less than off J plus. Plus reading creates a out vote again system, not out print. A are a set of squeeze records J and inside the brackets A. Our city square brackets shape, and that is our program. Of course, you may see that this program is fairly redundant. We could simply have another output inside the first full loop, and we could use an average integer variable instead of an array. This is, of course, true. However, this is to better show the array and our works on this 1st 4 loop. We are counting the places in the array and in these places were destroying a value into by the user. In this fully, we are counting the places in the array and in each place we're displaying the value. So let's run our program and taste out. I'm gonna enter 1 to 5. 1234 and you notice they're all displayed. Our second polo is successfully reading the array. Now, before this lesson ends, I'm gonna be sure in you an array may 3rd. This is a length method applied specifically to a race two created. It is as follows. Let me first erased this for loop. Create another output. And in Saudi, a put on her a r r dot length and that's it. No sets of brackets or anything just length on its own. What this medicine does is tell you how many places an array can hold. What this method does is tell you how many values that an array can hold. So if you were to customize and a raise says using user input, you can use this length tell you exactly how many places theory can hold. So as you could see, this array can hold far values. So it has to run my program again. You notice when our intimate valleys quickly so we can see the result that it prints the very far in the output. However, this isn't how many valleys are stored in the array, but how many you can hold. So if I was to move the fire in his fall asleep and replace it with four, I'll be would only store for values. So when I run the program and I stole these four values in, it's still prints five in the output, a useful method to use when working with a foreign arrange. So in this way, when creating and for live that applies to a specific an array, it is based to use this array dot length instead of a number that you have chosen on your own second place, for with a raid on length, copy the full Lupien, create the same output that I did for using the value in the four. So when I run the program again, you notice it runs the same way. 12345 and or Berries are printed below. This is one of the best and most efficient ways to work through an array that concludes this lesson. In the next video, we'll practice using a two dimensional array. 50. Two-Dimensional Array Practice: hello and welcome to advance Java programming course with Eclipse. And in this video, we're gonna practice using two dimensional arrays. Way will be using user input, so be sure to import the job. X wing packages in Port Charlotte X don't swing dot star closed with semi colon. Next, we're going to create a two dimensional ray to create it is as follows into a R and will have two sets off square brackets equals new int. And in these two sets, we'll have four and five. As you know, the first set of brackets will create Rose. The second set will contain columns. In other words, we've created full rows containing far values each. With that in mind, we have to create a specific full loop that will run through these places destroying different values. This for loop will look as follows for and I equals zero. I is less than four because we're gonna be working off the rose first. I price Plus And before we write any Kurt, we create a sick and full IP which will go through the condoms. Full int j equals zero. Jay is less than half J plus plus. Now that we've done that. We now store values and we're gonna be using user input. So we have to adjust the code accordingly. So they are. We then select available, which is referring to the rose, which is I been a variable referring to the columns which is J equals we pass because we are gonna be receiving a string from the user. Introgen don't pass into which option Pink show input dialogue and it's are the dialogue. Enter a number, thistles the loop. It'll help us go to every value. And of course, we're gonna copy this loop again for the airport sound of copied repast. And we changed the inside here to an output. Learn to look as follows System don't out, Dr Pentland. And it's on a r i and then Jay. To further see how this works, we're gonna add a system of print land at the bottom here To further see how this nested four loop works, we're gonna create an output that will separate the rose with a blank lunch system out dark print lan And we're just have double quotations because we just want online afterwards. How the slip works is the 1st 1 chooses the row starting at zero, which is the 1st 1 And then in that road we have a sick and full group which will run through the places, in other words, the columns. So this loop will run once. Then this will run five times. Then the loop again on the outside will repeat, and it's all run five times again. And I'll do this four times in total until all of the places are filled in the array. I'm gonna interior in five ones five twos, five threes and then fire Force, which will be separated by a blank line using this output once that values have bean are portrayed by this long. So let's run the program and test it out. And there we have our put. We have our five ones off twos, threes and force or separated for blank line. Of course, we can display it far more neatly by just simply removing Ellen so it can offer to not for box for you to see. So running the program again. Intern in the values and there you have it. That is how you work with a two dimensional array that concludes this lesson. In the next video, I'll give you an introduction to the split method 51. Split Method Introduction: hello and welcome to advance job, a programming course with Eclipse. And in this video, we're going to be discussing the split method. The sport method is a special method that works hand in hand with the array variables, more specifically, string arrays. What the split method does is it acts like a skinner and splits up tokens in a string, assigning them to places in an array. You can use the split method to decide how many places an array holds. In other words, you can have an array customers to alarm off text, so the amount of tokens that are divided in the string of the amount of places in the array and in these places will be the tokens. For example, if you decide to split a five Tughan string, the array will have five places. Here's an example way of using the split method String are a set of square brackets, equals S T. G. Referring to a string variable we created earlier Falana text dot split and in brackets double quotations and want you wanna split at. This can be an entire would but ignore Sabi, a specific character such as Watts face close with the semicolon. Suppose that s TGV book contains the following a random sentence. Therefore, they will be three tokens, therefore three places in the array. So if you were to use the length method to measure the arrange your notice, it'll printed value off. Three. As you can imagine, using an array with the split method to scan text files or, no doubt, to help you save lines of code in the future that concludes this. Listen. In the next video, we'll practice using the split method. 52. Split Method Practice: Hello and welcome to you Advance Java programming course with Eclipse. And in this video, we're gonna practice using the split method. The split method is fairly simple to use. First, let's create a string variable with an example blonde of text for us to split into an array string his TG equals and in the sentence our have the following. This is a random sentence. Next we create a string ary string A are a self described records equals stg, don't split and we want to split on what space. So let's have a set brackets, double quotation space, close the semi Khan. And in our output we will simply print the length system without parental on. They are doctor length and in our brackets, a r r dot length and let's run our program. It prints Father, which is correct. We're splitting on the spaces. There are four spaces and therefore they are five words, as you can see here. But this is a single character. So what happens if you wanna split on a word such as is well, you're noticed that splitting on is in this sentence will be slightly different to what you expect three you would think that there would be two. Seen as there's one is, however, Ursa refers to the is in this. This is the trouble with working with a split method. You have to be specific by what you wanna split. So if you wanna split under is word alone and not is, as in the two characters, we would have to add spaces before and after there is in the split method. So when we run the program, it does indeed split to two as we expected instead of as it did before. Being specific. And programming is vitally important as methods such as this can cause your program to throw errors when you get unexpected results. Now, before the lesson ends, let's output the values. So I'm gonna return the split back toward space. I'm going to create a full look for int I equals zero. I is less than a are that length I plus Plus, now that we have done that, we create an output system, don't out like print Ellen and in this output a r and a set of brackets with I and I'm gonna move this output loan and run out program, it splits. This is a random sentence. Five words and displays in below, and you'll notice with us. It doesn't include the wild space. So if we were to remove what space and topping is returning back to those three wooded terrain, So if we were to remove white space and replace it with is you notice that when we on the program it doesn't include is, in fact, you'll notice that it includes want space. But what is So you have this but is is removed. You have the white space before is and you have the space after is and a random sentence following it. So lock a sub string. You can use the split method to exclude specific woods or characters, such as is that I've been using in this program here, the Sputnik that is very useful when working with the rays and string daughter. However, you have to keep this in mind. Otherwise, you might see unexpected areas throughout. That concludes this lesson. In the next video, we'll be discussing a project for this section 53. 5th Project Discussion: Hello and welcome to your advanced programming course with Eclipse. And in this video we'll be discussing the project for the section for this project. Your toe. Ask the user to enter in to lists of sports, each list corresponding to a specific student. Thes two lists must be stored in two separate string variables. You're then two separate these strings into their own different arrays. Once you have split thes two strings into their raise your all in tears and if statement and the length field to find out exactly which student does more sports the first or the second. Once you've figured this out in your if statement, you're to display the first does more sports or the second does real sports. And then you are to display the sports that they do each port on a new loan that concludes this lesson in the next video. I'll give you my answer to this sections project 54. 6th Project Answer: hello and welcome to advance Java programming course with Eclipse. And in this video, I'm going to give you my answer to section force project. First, let's create our Java project In the discussion. I didn't mention a project name, so you can name it, whatever you wish. So that's new John Project. I am just gonna call my project Split array, Click Finish created Java Clause, and I'll give It's the same name at In the main Miss It. Click finish another three year that's imported packages will be using. There is user input as specified in the discussion, so we import Java extort swing dot star closer semi cut on. Now let's get straight into creating the string variables, which would contain the user input first strength. That's cool. It is one equals J option pain don't show input dialogue and in double quotations are, say into a list of sports food. The first sportsman and get straight into creating the array, which is split method, were divided into. Next we will create the array in which there is one string will be split into, so that strength they are one sit off brackets equals this one dot split and we'll split on what space, because that is much likely or the user used to separate the sports. Now that we've done that, I'm going to copy these two lines of code and adjust them to make the sick and sportsmen. So it is, too. That's a are, too. We, of course, adjust split as well to ace, too, and we have to adjust the messages well. So instead of first portmanteau top in the second Now this is different to what we've normally worked with. Definitive statement. But I'm going to save some Codina and I'm gonna use my length field inside the clothes A are one dot length. It's great to them. They are too Dutch length and a set of brackets. Now this is supposing the first sportsman plays more sports, so we have to have a message system dot out parental on the first Sportsman does a little sports clothes with double quotation Z. And now that we have the message we needed to display the sports, how we do this is about going through the array with a for loop circle and I equals zero. I is less than a on one that length I plus plus another set of brackets, and we print out the race values using the I in the bullet French AOL one are set of brackets and I, but this is only if the food sportsman plays more sports. We need to create an else for the second sportsman. So that's else open our set of brackets, and I'm going to copy the contents of the code in the first part of the if statement, paste it inside and adjusted. So that way, it's with second sportsmen such as the message first to second. It's a are, too Don't length instead of a in one, and it's a are two inside the on put full sports and that is our program. And now we're gonna test our program with two hypotheticals. One where the first sportsman plays more sports and one with the second sportsman place more spots. So for the first sportsman, I'm going to say he plays golf and cricket. And for the second sportsman, I'm gonna say he plays tennis and it's as you can see below. The first sportsman does more sports and plays golf and cricket, which is correct. Now let's run a program. Supposing the sick and sportsmen place more sports. So for the first sportsman, I'm only gonna say he plays golf with the second sportsman. I'm going to say he plays cricket and tennis, and when I run the program, we can see that else works correctly. We have the second sportsman does more sports and the two sports that I rented. This is my answer to this sections project. As you can see, we have used a raise and the two methods we learned to use with it split and length. If your program has the same amount or less lines of code, the congratulations, you have successfully completed this project. If your program doesn't work or contains more lines of code than mine, then hopefully seeing my answer here, we'll help you find the era. All help you shorten your code. That concludes this lesson In the next video, I'll be providing a conclusion of what you've learned in this section. 55. Conclusion to Section 4: Congratulations. You have just completed section four off your advanced Java programming cause with Eclipse in this section, you learnt about a raise a very complicated top of variable, which you can use to hold many values passages practicing what you have learned in this section of what you've learned in the other three. Practicing with what you know is the best thing you can do. Combining everything that you've learned is a great rate of progress in programming, as well as learn new ways you can program. For example, you can use the scanners to scan text Dallas and place the values in a raise, being that you can sozin array to hold as much daughter as you would want. You can use an array to hold an entire document with off doctor, not to mention that safety lines of code great in a more efficient program, a raise and the split myth that will no doubt come in handy in our final section of the course, where we begin to work with object orientated programming, which involves creating earned makes IDs and classes all to use them in the main program 56. Introduction to Section 5 | OOP | Object Oriented Programming: Hello and welcome to Section five of your advance job programming goes with Eclipse and in this section will be doing 00 P. Object orientated programming. In this section, we will learn how to create objects. We create objects through classes and in these classes will have several different methods that we can. You tell us to solve problems. This is the goal off object orientated programming to create classes and objects of your own design, which your use in your Main Program LTD's Your Great will be very similar to what you have learned throughout. Of course, the benefit off object orientated programming is by creating objects and classes you'll be able to reuse, submit that's over and over and over again. In other words, you needn't after out the same code. For example, by using a scan, a method you won't have to recreate different scanners with different takes falls you All you would have to do is used two methods. I wanted to call your text file and stole the daughter and a second rated, which will process in up with the daughter. The project at the end of this section will require a lot of what you have learned throughout this course that concludes this lesson in the next video are discussed with you how classes work. 57. Classes and Methods Introduction: hello and welcome to your advanced Java programming course with Eclipse. And in this video we're going to be discussing class is the best way to describe a class is a set of methods and fields that you can reuse over and over and over again. For example, the scanner comes from the utilities class. By importing the utilities class, you're connecting the package containing the scanner with humane program. So that way, when you use it in your program, it calls back to this close and runs the code within. In the next few videos, we'll learn how to create classes and two forms of methods that we'll be using throughout. The first top of method that will be learning is avoid method. A void method does not return a value, but it can be used to change daughter. The second top of method is a top method, which returns a value. A good example of the top method is the dot length misses that we've used in the past. Beard, the one with brackets or without brackets both return an integer, making them topped methods. An example of how a top method or look in your class is as follows as you could see, we have public string. We have the method name and a set of brackets, which will include the variables required. For example, when you're using a split method, you attach it to a string. The string is a variable that's required, and according to the messages, this is where your string will be stored. So as you can see, we have public string, Mr Name meaning it's a string method. This is how you can tell if it's a top method or not. If it's his public void, then we know it's avoid method. But if it's his public string for integer or any other top off daughter top, then we know it's a topped method. You're then have a set of brackets where the code will occur. You could change. The variable will use that I've your lack, but at the end of it you must output the result. How you put it is you top in return and the variable value that you returning. So these are the templates for creating a void or topped method. Re ourselves throughout. This course have imported several classes and use their methods. But in this section will be learning how to make her own. That concludes this lesson. In the next video, I'll be showing you how to create a class and avoid method. 58. Class Creation and the Void Method: hello and welcome to your advanced Java programming course with Eclipse. And in this video we're going to create a class and a void method. To create a close is as follows. First, let's create our Java project, which is as follows. I'm gonna call my project class taste. We go chop folder, right click on the Source folder at a Java class. Call it the same name class test at a public void Main method Click Finish. Once we have done that, we've created the main method. Once we've done that, we've created the Execute Herbal close for Tribune using throughout, of course. But now we'll create a class that isn't execute herbal but will contain code for our main clause. Go to the package and right click and add a new class for this one. I am just gonna call it print, and we won't be adding a main method Click finish and there we have it. We have now created a class. It's a simple is that for the second part of this video, we'll be creating a void. Method to create on is as follows we go to public class print, and this is where we'll be creating our methods to create a void method is as follows public, avoid. And now we have to give Avoid meeting a name. I'm gonna call it drawn. We add in a double briquettes. But we won't be adding any variables to these brackets. We're just gonna have a simple output. And we then great set of curly brackets as if it was an if statement and inside we'll have a simple system. Are Pentland system out Prince Lon and inside Hello world And there you have it. Avoid method one of the easiest Mase it's that you can create. We now have to create an object using our draw method. Now they has done me to import our class, seen as it is in the same package. So to use that, we have to create a object not to create the object. We first have to find our class which is print so top in the name print. We then give object a name search is called test equals new print a set of brackets close with semi colon. And just like that, we've created an object from the print class. But now that we've created an object let's use a method because as before, when we run the program, we noticed there is still no output. So beneath object. Let's use our method drawl, and it is simple as topping in the name of the object test dot and our Mason's name Joe, you notice it appeared in a box. They meaning that it was able to find I'll miss it and place it at the very top of the list . Now that we have object and we have now added the message to it, Let's run out program and there we have it. An output thes are the bay bones of object orientated programming. We have created a class code print. We have created a void mated with an output, and we now have object in our main program, and we have used this said method and created an output. A common question, I get asked in object orientated programming is how can we have an output and avoid mated? Surely it should only change daughter, but not output anything we'll avoid method can output daughter. It just can't return values, meaning you can't use this method to derive a value and store it in a variable in the main class for any other clothes that are associated with this package. Serbian mind. Having an output is very different from returning a value, but there you have it how to create a close and a void method that concludes this lesson. In the next video, I'll show you how to create and use a top method. 59. The Typed Method: hello and welcome to your advanced Java programming course with Eclipse. And in this video, we're gonna turn out a great and use a tap to method. First, let's create a Java project will be working with John A project. I'm gonna come on name processing because in this project, Ruby creating a program that asks the user to intended full name and we're gonna Prusis it using a top committed first, let's add our main class name processing at an our main method click finish not to Internet . We had another class and we're going to call this one the process. Cross inflict finish First, let it be known that our program is gonna ask the user to anti in the first name and surname was this first name and surname. We'll print out the initial the first name and the second name following. So let's create admitted that will do that for us. The processing method. Since this is gonna be a top automated, we're in a top in public and since we want to return a string string and we give a message the name such as process, name and we will be entering in a variable and that variable is a string as well, which will be the name itself. Now you'll notice there's an era without miss it. It is under land the land of year in rid. This is because our method is not returning anything to fix their We top in return and we want to return the name variable. So return name Just for now, we're gonna create another variable which will be returned instead of the name variable. And that is how you make a topped method. Sonal. It's entering the code which will be processing the name. So let's have name equal and the equals will be us processing the daughter and the following code. We want the initial of the first name. So that's the name Dutch are at zero the very beginning off the name. Then we add a full stop space. Next we make use of the substrate missive name don't sub string and inside the sub string method will make use off the index off method name the index off. And what we're looking for is what space. So we can find the white space between the first name on the last night, and we did add one to it because we want everything following the wild space, not inclusive off the white space. And in this land of code we have processed our daughter say knowledge. We've created our top two method. Let's go back to our main class and create object. So now we're back in our main program. Let's first import the package that allows us to ask the user for the input which will be in the job. X wing package import Java X, don't swing dot star goes with the cynical On. Next, we'll create the object that will be using So that's the process class being called. We'll give object. The name name equals new process clothes, a set of brackets and a semi colon. Now that we've done that, we're gonna create a temporary variable which will contain the name off the user. So it's a string Tim equals and now we have our input dialogue and inside the double quotations will be asking the user to enter your full name close to the semicolon. Now that we've done yet, we need to make you servile method, process, name and output. The result so are putting it is as follows system. Don't out the Prince line name dot process Name temp Now for top mated. You're more likely to stole this value inside a variable, such as an array when you processing multiple names. However, since our program will really be containing one name for now, we might as well just put the final result. This isn't the best way to make use of a top to method, just out putting the result as follows. But it is how we're going to show the results in this lesson. So we run the program. It's not asking us to Internet full name, so I'm gonna give it the example. Joe Blog's and Click OK and you'll notice in the output the initial dot space and surname. So oh, program is making full use of the process name method in the process class, and there you have a top to method that concludes this lesson, and the next video we'll be talking about profit variables 60. Private Variables: hello and welcome to advance. Drove a programming course with Eclipse. And in this video, we're gonna learn about profit variables. Profit variables are variables that cannot be changed in the main program. Meaning these are variables that only work with a specific class. For example, I have Yeah, the name processing project re created in the previous video. And I'm gonna show you in this class how to create a profit. Variable product variables are usually created at the very top of your class. So we go over here to the lung public loss process, press inter afterwards and we start creating a product. Variables. Here is an example of a prophet interject profit int number being that this very bullet is made at the very top of the class. Any other methods that you make later on can use this variable. So keeping this in mount a profit variable can only be changed for the programmer. In other words, it is profit from the user when creating programs that use user input. It is often that the user will temper with the code as such having profit variables that maintain the call of the program are important in this way, you can avoid massive areas that the user imparts upon the program itself, where they intentionally or unintentionally. However, although the NUM is profit to this class, we can display it in the output box. How we display it is as follows we create a miss it. This is the one way you can get a prophet indulges value from the class. Of course, you'll have to create a line of code in the main program calling this method, but it is still a way in which you can get the valley off a product integer from your program. You first create a top variable or avoid one, so let's try using Avoid, for now, public void and it's call it numb print and inside, a set of brackets will have an output one and inside number. Now that we have that, your notice that the variable none is highlighted blue, just like the private into European. This is because the private Introgen, um, is present in the entire class, so there's no need to create a local variable inside the method. Now going back to our program. Let's adjust the code, so that way it will print out the Num Valley. So let's comment out this land over here, since we won't be using it and we'll comment out this land as well. With that done, we now make use of automated name, dot numb print and we run out program Notice it prince the value of zero because Numb has no value. Currently to change this free, go back to our probably available. We give it a value. Five. We run the program again, and it prints five, and there you have it a profit introgen or private variable, depending on which you use. These are mainly used for default values throughout the program, present in an entire class and very useful and very hard to adjust without the right code that concludes this. Listen. In the next video, we'll create a scan emitted in a class. 61. Making A Scanner Method: Hello and welcome to your bronze Java programming course with Eclipse. And in this video, we're going to learn how to create a scan emitted of our own in a separate class. I have opened a previous project. We did the file read of practice program. Much we're gonna do is added close and move our scanner to that close. How we will do this is as follows we go to our package file reader practice, we create a new class. We're gonna call this one scanner. Lower case is like finish. Once we have done that, we're gonna go back to our main program and copy everything from the bottom of the catch to try. Once we have copy that, we go back to our scanner, and here we'll create a method called file skin, so that will be as follows. Public void file skin and inside a set of brackets, I'm gonna put a string variable. Could file name. After that, we create a set of records. We paste our code inside, we'll go back to file, read a practice, remove the code that we have copied. Once we have removed the Kurd were gonna import the job extreme package because we are now going to ask the user to enter in the file name. In other words, we have now creating a program that works with any foul that we name. So that's Job X, not swing dot star closer the semicolon After that we create a string variable were also call it file name equals, and they will have input dialogue and inside double quotations into your file name. After that, we create an object from our scanner class A scanner, and we're gonna call the object file. Reader equals New scanner Bear in mind. It's lower case. It's because we're working with our own scanner instead of the original one. Now the true greats object. We go back to our scanner costs, and we had just occurred accordingly so that weight names dot txt is replaced with a foul name. Now that that is finished, we go back here again and we use I'll miss it. So it's follow rita dot file skin using our family invariable and just like that, in a few lands of additional could, we've created an object orientated program using the scanner. So our main program now only contains three lands off core code when you run the program and let's enter in the text files name, which is names dot txt click OK and we see all the results from before printed, clear as they were. So our programme is successful. Not only are we created an O P program, but reverse it created a program that can work of other text files all off a few lands of additional code that concludes this list. In the next video, we'll practice our object orientated programming. 62. OOP Practice: Hello and welcome to advance. Drove a programming course with Eclipse. And in this video, we're gonna practice object orientated programming. First, we're gonna create our project. I am going to call my project object practice in this project, our great A main clause of the same name and the main message inside the package are also creates another class. And this one I'm gonna call the Read Cross in this project will be using a text foul rust, a dirty Eckstine. We're gonna be reading from this text phone and processing the daughter. Don't worry. I'll be providing you with the text found. The daughter looks as follows. We have a name, surname, an age and agenda returning to the program. I'm going to show you how. Read the text phone, using object orientated programming as well as process it. We are going to be doing on our main code from scratch in the read class instead of copying code from other projects. First we're gonna import the files that we're gonna be needing, which is the utilities and I O package import Java, don't you till don't start close the semicolon and of course, the Iot package. Same from the YouTube about stop. Now that we've done that, we're going to create the prophet variables will be using throughout. First, we're gonna create a string array private stream are a set of brackets, equals new string. For the length we're just gonna enter a large number in this large number, it is the maximum amount of daughter we could receive. The text file won't contain as much daughter, which is good so we won't have an out of bounds exception. 50 is just a larger on value that will keep our program working close to the semi Conan, we're gonna have to other private variables. A profit interject code count equals zero and another string chord result Private string result equals and we're just gonna have our double quotations. This is, of course, in case result is needed, but the honor values to be imported into result as such to avoid this era, we replaced the value off. No, with the double quotations. Next, recreate our first message. The read file method, which reads as follows Public void breed file, a set of brackets and a string which has file name inside. We'll be doing what we did in the previous program where the user enters in the file name. Next rule. Have a try and catch statement which will read the file. Try a set of brackets are scanner, see file equals new scanner new file and then saw the brackets file name closer to see me. Go on. We then have a wildly which will run through this file and place each land in the array one by one. So that's a while s C file that has next. So we know it will go through every valley. Then we're gonna use our array. And the comfortable together equals a C phone. Not next close with semicolon. We want the entire land stored in the rain. We didn't have count. Plus plus for the next one. After that, we have no need for the S e far scanner. So we close it. Yes, he found up close and we move on to the catch, which is catch file, not found. Exception e. In case the foul isn't thing. And then we create an output which shoots it system that out of Princeton and the error message will be file not found. And there we have our first message the read file method which will read the text far and place the daughter within the ring. We will call our sick admitted process which will process the daughter. It will look as follows public, avoid process, I said to brackets and inside a full ooh which will go through each line int I equals zero . I is listening count. You notice the count comes in and again and becomes very useful because I kept count of exactly how Maney values are stored in the rain. Close this Emiko on plus Plus, This is why we created accountable instead of using a radar length because that would have been inaccurate unless array had exactly 50 values. Now we use the S C Land scanner scanner salon equals new scanner and inside a are square brackets I and we'll start with the first landing. The results will be printing is as follows. We have the initial of the first name, then we'll follow to the last name. After that, we'll have the age and then we'll have the first letter off the gender. So that's info male. And if for female, we'll store this value in result so to do so we have result equals result, plus a salon next door charm at zero to get the initial and we'll add the full stop in a space. After that will add The last name upsets SC Landau next again, since it's the next drink at another space they were at the age and finally the first letter off the gender space a salon talk next March are at zero, and that is our process result being stored in the result. Variable On the next line, we closed the land scanner because we will have no need for it. And we would like to start fresh So it's close. Add a semi coat on that is our second referred and are read class. We now create 1/3 method called print result, which simply returns a string which is result so public string print result return results . Now that we have completed all of our code in our read class, we go back Charlemagne program and make use of it. First, we're gonna ask the user to import to found them so we have to import the swing packages once more. Not swing. Don't stone. We then create a string variable, which will contain the foul name equals diet, import dialog and in double coach ations into a file name closer the same you can on within create our read object. So this is called a Taste for Now equals new Read Within years. Our first method, the read file method said test dot reid file and inside we'll have finally within use are sick and may said to process it. And finally we create an output and print the result. So it's test dot print result, and there we have it. We have all of our values printed below. We have the initial the first name, the second name, the age and the genders initial all day. This is a more complex 00 P. Program, and I hope you find a good practice for our final project to this section that concludes this lesson. In the next video, we'll be discussing the project for this section 63. Final Project Discussion: Hello and welcome to your advanced Java programming course with Eclipse. And in this video we'll be discussing the project for Section five. In this project, you will create a program called Object Processing Your then to create a class inside this project called File Reader and you'll be using to Text Falls, the Final Dirty Eckstine and final result Doc Txt I will providing of both of these text files. The purpose of this program is to scan the text fall final dot txt. Process the doctor into information and right to text from, as in the final result of txt the results of your processing methods. Your program will contain four methods and your first method. You'll read the daughter from the text Farm, for example, Joe hashtag blog's HASHTAG 29 and in this method you will populate a profit array in your sick and miss it. You're to scan through the daughter and found the oldest person. Once you have found the oldest person, you're to place their values into a separate private string. For example, Joe Blog's 29 is the oldest is sued Miss. It will scan through the rate again and process the rest of the daughter, including the daughter, off the oldest, and stole the results in a private string. How your Process. The Doctor is the initial the first name initial the second name, followed by the age each name printed on a new Lon, and your final method is to create a print writer, which were right to the final result of txt. All of the information that we have processed your final result should be the oldest displayed at the top of the text file. For example, Joe Blog's 29 is the oldest and below it you'll display all of the process results. In other words, the initials and ages off all of the daughter, including that of the oldest. In the next video, I'll give you my answer to this project. 64. Final Project Answer: hello and welcome to your advanced Java programming course with Eclipse. And in this video I'm going to give you my answer to the final project For this course. As you can see, I've created the Program Final Project with Class Reader. Inside the final Project Project folder, I have placed both text files faneuil dot txt, which contains all the road daughter and final result which will contain the results. When I run my method without further ado, let's begin. According first, we're going to our class and we're gonna import. The two packages will be using the I O in utilities package import, java dot util dot storm and the second package import java dot io dot star closed the semi coma. Now that you have done that, we're ready to create private variables will have full profit fables in total will have a encounter. So private int count equals zero. We will have an array. Private string theory equals new string and we will give it the basic value of 50. We'll have a string for the oldest and we'll have the Prophet string for results. Now that we have done that, we're ready to create our first method, but I'm gonna show you now is what is known as the starter method. In other words, this is the meter that runs the moment you create the object you needed to write a line of code calling the method in the main program. This isn't necessary. Of course, you can continue to make methods in your own way. But Sina's our program is fairly certain of what its purpose is. We can have a started mated with the file name included. So from the moment we creator object it is located and scan the text files already to create this method is as follows which up in public and instead avoid or topped methods such a string of integer We just give the name off the cost that it's within. So, public reader, Now that we have done this, we're gonna have a set of brackets and we're gonna be using file name because the user is gonna be the one that enters in the file name and all the code that we need to scan the text fans. That should be the trial catch statement. I said, try And inside a state of brackets, Skinner is he filed equals new scana new file file name. After that, we create a while loop while a C found that has next. And then we start putting everything into the rain. Says they are Count Goes is he found Doc Next count Bless place just like we did in our practice. And since we don't have the file scanner is c phone. But close discloses its semi colon and now we create the catch catch file not found Exception e and a suitable message system that at Princeton on good not find file and that is our 1st May said So from the moment we have created our object, we have scanned the takes are and placed all the values in the area. Our next method will find the oldest. This will be avoid method so public void and it's called find old for this myth that I'm gonna create a interject called old equals zero which will be our temporary valiant which was stole the age next to create a full it which will go through the arrange says full. Didn't I equals zero? I is less than count I plus Plus in this full up I'll be using a scanner to get the age said scanner salon equals new scanner and we're gonna plug in the value a r r i. So a new scanner will be used every time. And as we know in our daughter, if we go look back at our text files, they're all separated. All the valleys are separated of a hashtag. So we have to change the deal emitter accordingly. So dot use kalamata hashtag closed the semicolon. Now, as you know and our final output, we have to display in the text file the full name and age. So we need to get a variable which will hold the first and second name is giving down factory in a string temp for now equals a salon dot Next, that's a space has a salon Next which will hold the name we then created interject which will hold the age a sea lion Don't next and that's what we need to do with the scanner. So now we can close it so that we re sets to run through the next values we now create a if statement which will Compean numb too old in this way we can find out who is the oldest as we gradually run through the array. So that's if number is greater than old. Old equals numb. So that's the new value. Oldest are private label equals Tim, plus space for us Old is the oldest, and then we ever output for the oldest stored perfectly in our private variable. And now, for our next method, this will be our processing method, which will also be void Public Boyd process inside are processing method will create a for loop portal again. Run through the rain full and I equals zero I is less than count I plus plus Next, recreate the scanner a salon once more to go through the rays values equals new scanner. And as before array, I and we have to change the diameter Don't use to limiter hashtag. And now we're gonna store varies in the results. Private variable says results equals results. Plus and as you know, we working with the initials of the first and last name. And then we have the age starting a new line after. So that's plus a salon dot Next I don't char get zero plus a salon dot Next again don't charge and zero plus another space, plus the age, which is a CNN dot next. And finally we start a new line. So backslash in close with Semi Colon. Now that we've done that, we can close a scanner no longer having a need for it. And that is our processing method and our last message, the one which will print to file which I'll be calling print e file. So it's public void print Cheer closer to see me come. And since we're gonna be working with a new file, we have to create another trying catch statement inside, we'll create a print Terata good at file equals new Terata new file Roger and inside a set of records we know which file we right into, which is the final result, Doc T X t closer the semicolon. Next we put to that far using the print land method for far sets at dot Frenchman And how he printed is we have the oldest first plus in your lung bless results close with See me coat on. And now we no longer need the print writer. So we close it out, fell got close. Next we create the catch and this time. It's an Iot exception and a suitable message to finish your system. Done out dot print land Final results takes foul, could not be found. And there we have all off are my kids. We cannot go to our main program and make use of them first. As you know, we're gonna have the user choose which filed to scan. So we're gonna need a job extreme package. And then we're gonna have a string to contain the foul name, which I will be calling. Found me equals J option pain show input dialogue. Enter the name of the text phone close with the semicolon within, creates our object from a reader close cell is called reader, and we'll call object. Test equals new reader, and it's gonna require you to enter in 80 string variable. This being the file name, file name close the same it going on. And now we use our methods. First we have to find the oldest. Then we have to process it. And lastly, we need a print to file and they have our entire program five lines of code in our main class. So let's run out program top in the name of our text file, which is funnel dot txt and click OK, returning to our Projects folder. We go into final result and you'll see on our daughter the Processed. We have Frank Thomas, the age of 99 at the top of our list, and he is still included inside the process daughter. So our program is working correctly, and that is my answer to the final project that concludes this lesson in the next video. I'll give you a summary of what you've learned in this course. 65. Conclusion to Java Programming: Your Guide to Beginner Java Code: and that concludes your advanced Java programming course with Eclipse. At the beginning of this course, you learn to many methods to help you on your way towards object orientated programming. By the end of this course, you're making your own methods in your own classes. Simply put, object orientated programming is focused on the use of objects and being this way, it means that you have to have several classes and message to use with the subject. So you have learned how to do just that. An object orientated programming usually has in its main execute herbal very few lines of code, but in the classes deep within, they are large amounts occurred that have been written behind the scenes. You have coded programs that many struggle with in they studies towards object orientated programming. There were civil projects throughout the schools, and energy learned that programming is logical creativity, meaning programs could be made in many different ways. You can have very different methods to those of another programmer to complete the same task. However, with practice and further study, you'll be would have found better ways in which you concurred programs constantly improving as you go. Thank you for taking my advanced course on Java programming with Eclipse and good luck with your studies on Java programming.