JAVA for everybody: Introduction to programming and Java. | Hadi Youness | Skillshare

JAVA for everybody: Introduction to programming and Java.

Hadi Youness, Computer Engineer

JAVA for everybody: Introduction to programming and Java.

Hadi Youness, Computer Engineer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
18 Lessons (1h 4m)
    • 1. Introduction

    • 2. Why do we use Java?

    • 3. Install Java

    • 4. Install Eclipse

    • 5. Create a project and introduction to data types

    • 6. Primitive Data Types

    • 7. Non-primitive Data Types: Class and Interface

    • 8. Non-primitive Data Types: String and Array

    • 9. Decision making (if, if-else, switch)

    • 10. Loops: for and while

    • 11. Unchecked Exceptions

    • 12. Checked Exceptions

    • 13. Try and Catch Block

    • 14. Create an Exception

    • 15. Get an input from the user

    • 16. Project: Build a Calculator!

    • 17. Hints and Bonus

    • 18. Recap

  • --
  • 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.





About This Class

This class is designed for those who do not have any previous knowledge in programming or who already studied another language (not Java).
Java is one of the most popular programming languages and it is widely used in different domains. It can be used to create applications, games, and more...
This class is an introduction to the basics concepts in programming and Java. It is a short class yet covers all the basics and materials that you need to be able to write good code in Java.
If you have any questions while watching the videos, feel free to ask me!
Thank you for watching my class and Enjoy!

Meet Your Teacher

Teacher Profile Image

Hadi Youness

Computer Engineer


Hello, I'm Hadi. I am studying Computer Engineering at the Lebanese American University (LAU). I like to share my knowledge with everybody and I believe that teaching is a perfect way to understand anything since you must be well informed about something to be able to teach it in the simplest possible ways!

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
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.


1. Introduction: Programming is an exercise for your brain that eventually improves a problem-solving and logical ability. Learning to code with teach us how to solve the problems we encounter every day in our life. So if you're new to programming, I think that this class is suitable for you. And even if you already know another programming language, this class was also helpful in terms of syntax to unhealthy Uranus from the computer engineer and up in studying Java for the past five years. And this class, we are going to learn some basic concepts such as data types, how to store data, use it, and modify exceptions, and how to deal with them and lots concepts. Then we'll end our class with our project, which is how to build a calculator. So let us, let's first install Java and Eclipse and start coding. 2. Why do we use Java?: There is no such thing as the perfect language tiller, banal thing, that Java is a great choice even if you're a beginner. So first of all, we'll talk about why you should learn Java. Java is everywhere. It has a rich API and has so many development tools. So Java is everywhere. Companies like Amazon, Netflix, Instagram, Google, Spotify, and Uber use Java and their texts tags. Also, Java has a rich API. Api is a set of tools that programmers use. Have them create software. So we have no issues with compatibility. And it provides API for utilities, XML parsing, networking, and I0, which we'll discuss later on. Finally, we have Java development tools like NetBeans, IntelliJ, Eclipse, and Android Studio and discourse we use Eclipse. So in the next couple of videos, we'll download Java and Eclipse. So if you already have them, you can just skip the next two videos. 3. Install Java: In this video, we'll download Java. So we'll go to Java JDK download. Most probably the first page will be from So go ahead and press JDK download. I'm using Windows 64 bits, so I download this one when the dxi, I accept the agreement and just press download. It will take some time to be installed. So we'll just wait. Now, this is our JDK file. Download Java. Just open the file. Click on next and then next. And we had close. Now we go to Windows and then to Program Files. Now we can see that there is a file called Java JDK 14.2. So the most important file is the bend file. So we'll go ahead and copy this path. And now we go to our settings to add this path. And we can go to edit the system environment variables, environment variables. And we have here. So we can add this. But here, you press OK. Now to check if Java is working with just type Java virgin. So this is Java virgin, Java C. So it's all set. 4. Install Eclipse: Now to download Eclipse, we simply go to Eclipse and go to download. Can see download 64-bit. And here we just click on download. And it will start downloading automatically is around 52 megabytes. So we'll wait a bit to now, Eclipse is installed, so just open it. And we see Eclipse IDE for Java, C, C plus plus, and java script. So we go ahead and choose the Eclipse IDE for Java Developers and click on install. So this is the folder which alpha where Eclipse is being downloaded. It will take a bit. So now, since the installation's completed, who just click on Accept and lunch. So now we have our Eclipse IDE 2020. This is Workspace. We can keep it as default and lunch usually takes some time. Okay. So now this is the welcome page. Let me go ahead and just less. So this is our page. And in the next video, we'll create our first Java project. 5. Create a project and introduction to data types: Now this is Eclipse and create our first project. Took simply click on create a Java project. Let's name it project one. Don't create module for now. And this is, as I see, means source. And here we saw all our classes. So we'll create our first package and let's name it. And then create our class, class one. So this is our class plus one, which is N package one. So for now let's print something. For example, public class, public static, void. These are keywords and we'll discuss them later. But for now, let's print out hello world. So system is a class built in Java. Out is an instance of print stream type, which is public and static member of this system class. And print is the method that we're using. So let's go ahead and run this code. We can see Hello world. Now we print something. Example hello. As you can see, if we run the code, you can see Hello world followed by hello. So to fix that, we have print line. So instead of just typing System.out.print, we'll type system.out.print. And this stands for line. Now if you go ahead and run the code, we can see hello world and hello on another line. Now, the first thing we can do with a code is to store data and read. And in Java, we have primitive and non-primitive data types. Primitive data types are already defined in Java and they always have a value. However, non primitive data types are created by the programmer and they can be null. As we can see here. In this tree, primitive data types include Boolean, director, byte, short, integer, long, float, and double. And the non primitive data types include Strings, Arrays, classes, interfaces, and we'll discuss each and every one of them in the next video. 6. Primitive Data Types: So in this video, we'll talk about primitive data types. We'll start by the integers, which are Byte Short, and along each one of them has a specific size. So for example, the byte stores and whole number between minus 212800127. So if want to try it, we can just, they bite b equal 127. So we can see that it works properly. However, we just add one to this number. We can see that it generates an error. It says cannot convert from end to bite, since this number 128 is not abide anymore, it is considered as an integer. So to fix this, we either return it to 127 or if when you used 128, we can use another data type such as short in this case, can also use and and long. But if we're absolutely sure that our number will not exceed 32,767 in this case. So there is no need to use them. You can only use short. And the same case for integers. The integer equals a 100, for example. It will work properly. Now concerning the long, we say long equals a 100100, we can see that it works properly. However, if we add some zeros, it will generate an error. Because this number is out of range. This number is now considered as an integer. And this, the integer cannot exceed this strange. So to fix this problem, we just add and at the end of the number two to say that this number is long and not an integer anymore anymore. Now, moving on to the floating point numbers. So we have two types, float and double. Plot. F equal a 100.4 for example. However, we cannot, cannot use it like this. We just need to add F to say that this is a floating afloat. Now, for the double, double d equal this number. We can add the, for the double at the, at the end, but you don't have to. Now, for the character variable, it is written as char. Can say char t equal, for example. So it is used to store a character consisting of only one letter, which is in this case the letter a. So for example, if we use this a, we are saying that we want to store the character a and the variable name C. So we use the simple quotations for characters and the double quotations for strength, which we'll discuss data. Lastly, we have boolean. Boolean. We can say boolean. Boolean, true. Mainly this variable have, has only two options, true and false. This used to perform logical operations, most commonly to determine whether some condition is true, and this is it for the primitive data types. Next, we'll talk about non primitive data types. 7. Non-primitive Data Types: Class and Interface: Now we talk about non primitive data types. So I'll first non primitive datatype is class. A class in Java includes all our data and contains all variables and methods. So to create a class as we did before, we create a project and then our package, and then we can create our labs. So Let's go ahead and create another class. And let's name it Student. So this is it lastName student. If you want to use the, the methods in the class student and class named class one. We need to link these classes. So to do that, we just create student and name it. For example, Student one equals new student semicolon. So what we're saying here is that this is the class name, student, This is the object name student fund our object. This is a keyword, new, and this is the constructor. Now, let's go ahead and create a method here. So for example, we can say public static, void method. So this is the method and these are keywords. So we don't need to know about them now, we'll discuss them later. Let's just print in this method. This is method one. Now, if we go ahead now and say student one dot, we can see that there is method one here. Now if you're gonna go and run the code, it will print. This is method one. Now moving on, we have something similar to class, this code interface. So let's go ahead and create our first interface. We can go to new interface. Interface one. Finished. This is our interface. As a class and interface have methods and variables, but the methods declared in an interface are by default abstract and don't have any body. So if you create a method called method one here, public void method one. If we tried to open the braces to generate an adder, saying that abstract methods do not specify a buddy. Now, to use these methods, we need to override them and our class. So to do that, we must implement this interface and our class we simply add here, implements an interface one. So now it generates an error saying that this class class must implement the Inherited abstract method, an interface one. So we only have one method in interface one. We need to inherited. So we either type override and, and then we, we type the method or we can simply press control space on before the main method control space. And it will override every method. Now we only have one, so we'll just override it. So this is the method, method1. Now, there is no error written, just friends. This is the first method from the interface. Now, if we go ahead and say interface one, name it, enter equal mu plus one. And say Enter. We can see that we have method one. So if we go ahead and run the code, you can see this is method one. And this is the first method from the interface. If we want to just separate them, we can just print a line. This is method one, and this is the first method from the interface. So now, in the next videos, we'll talk about strings and arrays. 8. Non-primitive Data Types: String and Array: This video will talk about strings and arrays. In Java, string is an object that represents a sequence of characters. And we can do so many things with this object to go ahead and create our first Jane code name one equal Alex. If we want to see all the methods available for us, we just type name one dot and we'll see all of them. One method is to uppercase. And it will convert all of the characters in the string to uppercase. So you go ahead and use it and then print name one. We can see that nothing will happen. The name will still be the same. And this is because we didn't save this method. To fix that we either create a new string called name for example, and now print name. Or we can simply say name one equal l1, l2 application. And then print name one. Another method would be to lowercase. So let's go ahead and create a new string called item. Name two equal to lowercase. And then printed. And then we can see that all the characters are in lowercase. Now we'll talk about the charAt method. And this is a very important method. Charat. It will return a character value at a specific index. Since a Pulitzer a character, then we need to store it in a character data type to just store it in the character c. Now we know we need to specify an index. And Java, we sought by the index of 0. So a is at index 0, d is at index one, and so on. So if we want to take a time 0 and then print C, we can see that it prints a from atom. If we want to take another director named three for example. And print. It will print M, since it is the third. At the third position, 0123. The last method we'll talk about is that. And this method to take two strings and compare them and return a Boolean. It returns true if they are equal and false if they're not. We need to compare name one with name to. We can just say name one dot equals and then name2 inside. If there equal to return true in this case than not, and it will return false. So if we just modified this to Alex, will be the same. It is false because this Alex is in uppercase and this Alex is in lowercase. So if we just say to uppercase, now, it will say true. This is it for strength. Now will talk about arrays. Arrays in Java by data structures implemented as objects. Using arrays, we can store one or more values of specific datatype. So to create an array, we need to specify its type. This means what type of data that they I will hold. So let's just erase this and start. First of all, we need to specify the type. Let's say we want to use an a of integers. We just say nt and our A1. This is the name of our array. And then after that, we need to like new. This is a keyword to allocate memory. And then we just enter the Type one more time. And in this box now we need to specify the size. The size means what, how many elements and I should be. So if we say four, then there's only four elements in this array. As we can see in this picture, the eye starts with index 0 and end with index length minus one. So this array is of length nine to start with 0 and end with eight. Now if we go back to our code and to build this array, and Y1 of 0 equal to 1131 of two equals a, for example, and everyone of three equal nine. Now, if we say A1 of 510 for example, and run the code. This is an exception because array index out of bound exception. Because we used an index of five, while our array can only fit 24. So we need to just erase this. And now, if we want the value eight, we print everyone at index two, which is eight, and the one at index three is nine. And now this is a non primitive data types. 9. Decision making (if, if-else, switch): Decision-making in programming is similar to decision-making in real life. Sometimes in programming we face some situations where we want a certain block of code to be executed when the condition is fulfilled. Java has some selection statements. First, we'll talk about EFF and fs statements. For example, if we have an integer called x with a value of five, we can say that f open parenthesis, X equal equal five. Do something. So just open the braces. Now. Party to equals means that we are asking that if x is equal to five. Now, if this is the case, print x is equal to five. As we said earlier, double quotations stands for strings. So if this is the case, print the statement. So if we go ahead and run, it will print x is equal to five. However, if we have x is equal to four, and we run the code, nothing will happen. Here. We can use s. So if this is the case, print the statement otherwise, else x is not equal to five. So if we go ahead and run the code, we can see that x is not equal to five. Now we talk about switch case. Let's say we have the same integer x equal to four. So to write a switch statement, all right, switch and x. And we have the switch. So we write the cases, case 0, x is equal to 0. This one, brand that x is equal to one. That's just a default when x is greater than one. So in this case, if we go ahead and run the code to pray to reprint that x is greater than one. However, if we have x is equal to 0 and we run the code, we'll see that it will print the three statements. X is equal to 0, x is equal to one, and x is greater than one. So since the first case is correct, Java print the first statement and it will continue to execute all the others. So to fix that, we just add briefly to application. We don't need to add the brake to the default one because it is the last one. So break means that I am finished with the sequence and I want to get out of this switch case. So now if we go ahead and run the code, we can see that it says x is equal to 0. So this is it for the switch case. Next, we'll talk about types of loops in Java. 10. Loops: for and while: Loops are used to execute a set of statements repeatedly until a particular condition is satisfied. We have three types of basic loops for while and do-while loops. In this video, we'll focus on how to use four and wild loop. So let's start by wild loop. First, we'll create an integer x with a value of 0, then y. Now we need to set our condition. While x is less than five, execute this code. Sorry, when x is equal to. So. Remember, this double quotation represents strength and acts outside these quotations. Is the variable x. Now this loop is an infinite loop since x will not reach file. So if we go ahead and John will not. And so that's just close the program. Since x is always 0. Now to fix this, we need to increment x. We can increment say that x is equal to x plus two, for example. So every time we enter the code, x is incremented by two. So if you go ahead and run it now, Ax is equal to 0. So first as is equal to 0, that condition is satisfied. Then we execute this code. We print x is equal to the value of x, which is non-zero. Then we incremented by two. We go again now to a smaller than five. So we printed Ax is equal to two. Then we increment it by two. Now we have four or smaller than five. Then we print it one more time. Now, Ax is equal to 64 plus two. So we go to the condition six is not smaller than five. Then we exit this loop. So we can say x, x plus one to 01234. We can also use x plus equal to one. It's the same as x equals x plus one, or x plus, plus incrementing, incrementing x by one. They're all the same. Now, this is it for the while loop. Moving on to the for loop. The general form of a FOR loop is as follows. So alcohol, for example, i is equal to plus. What we're doing here is that we are defining an integer variable called i. We are defining for only one time. So the first time i is equal to 0. Now, the loop should continue while i is less than ten. So first we create I is equal to 0. We said we check the condition. If i is less than ten, the condition is satisfied. We need to print i is equal to 0. Then we go to increment. We increment i by one. Then we check the condition one more time. One is less than ten, then we print it. Then we go and increment again and again until i is equal to ten. If i is equal to ten, then this condition is not satisfied anymore. So we just exit the loop. However, if we want to use IE is equal to ten, then we can just set the condition that satisfies what we want to use. So here till condition is i is smaller or equal to ten. So if we run it, we can see that we have i is equal to ten. Let's just try it. Another form of for loop. It's the same but decrementing. So let us say r is equal to ten. Now, the condition should be I. For example, I is bigger than one. Then 0. Now we need to decrement. So let's just print it as equal to us. So it will start by 10987 all the way to one. If you want to use, we can just add equal and it will print i is equal to 0. So here we can use multiple eyes, since every i in is in the for loop, it is defined in the for loop. However, if we use pi equals 0 here, we cannot use it anymore in the for loop, since this duplicate local variable, you cannot have two eyes in the same code. So this is it for the for and while loop. Next, we'll discuss the types of exceptions. 11. Unchecked Exceptions: In this video, we'll talk about exceptions. As we can see, throwable has two subclasses. Error, an exception, an exception, we have runtime exception and IOException. Ioexception is a checked exception. This means that they are checked at compile time and you should handle them before running the program. Otherwise, it will give us a compiler error. Now we'll focus on runtime exception. And the next video we'll discuss the checked exception. Runtime exception is unchecked exception, the compiler do not check them. They are discovered during runtime. For example, we have arithmetic exception. So if we go ahead and create an integer x equal than y equals 0, this exception is thrown when an exception condition has occurred and an arithmetic operation, for example, we want to divide x by y. It will generate an exception, saying this is an arithmetic exception, we cannot divide by 01. Way to fix this is to have a double value of 0. And now if we run the code, we can see that it prints infinity since ten divided by 0 is infinity. Another exception would be null pointer exception. The exception is raised when referring to the members of an object. Nile represents nothing. So if we have, for example, a string, we said that string is a non primitive datatype, so we can have null. So for example, string name equals null. Now, if we want to use this name, we can go ahead and say char c name dot 0 for example. So this right here will generate NullPointerException since we have nothing in name, so it cannot refer to it. Another exception is string index out of bound exception. So if you have a string called Alex and wanna use index tend to generate an error. String index out of bounds exception. So it says string index out of range. So we cannot use ten new to use an index in the range from 0 to three in this case. And it will work. The last exception we're going to learn is array index out of bound exception. So this exception is thrown to indicate that an area has been accessed with an illegal index, just like string. So we'll go ahead and create a new array of size four. If you want to use index file for example, or for to generate an array index out of bounds exception and X five outbound for length for even if we use four to be the same, since four isn't the last index, as we said before, the last index is the size minus one. So if we say three, for example, will, will probably. Now, this is it for the unchecked exception. In the next video, we'll talk about the checked exceptions. 12. Checked Exceptions: Now we handed the checked exceptions. As you can see in this tree, IOException, which is a subclass of exception, is a checked exception. We have file not found exception. So to deal with that, let's go ahead and create our file and learn how trees from it. So we go to project and create outfile, same it file. Let's try something, a little Java file. So we have three lines in this file. So to read from this file, we first need to import the file is built in Java, so we'll go ahead and just import it 5V, the name of new file and the name of the file dot dx t. So now we can put the buffer in which you need to add this file reader. Now always said, but you can see that it generates an error, an exception actually. So the exception is fine, not found exception. So to deal with that, we need to throw this exception. We can throw file not found exception and import it. And since file not found exception is a subclass of IOException, We can also throw IOException and throw this exception. Or of course we can just go exception in January. So exception work without importing these exceptions. And now to read this file, let's create a for loop. Let's read the first two lines. So i is less than two. And Brand B, r dot bead. We have breed integer, integer, feed line four strings. So strings in this file. So let's go ahead and use this method. So what we can see is that the first two lines our printed. So if want to print this third line, for example. Now, we had a three to say for the null and the fourth line. So this is it for how to read a file and how to handle a checked exception. Next, we'll learn about try and catch block. And then we create our own exception. 13. Try and Catch Block: Now we learn how to handle the exception in another way. So to do that, we can use try catch block. So instead of knowing these exceptions, just go ahead and create a guy. So try this code, something known husband. The exception code. Also, we can print the message of this exception. So let's just run the code and we can see that nothing happened since we have the file here. However, if we change the name of this file and run the code one more time, we can see that file one dot TXT, the system cannot find the file specified. Since we don't have a file named file one, we only have five. So this is it for try and catch unchecked exceptions. Now try and catch and also work on unchecked exception. So if you remember, we used to have an arithmetic exception. So we'll have x equals ten, y equals 0, and we want to divide X by Y. So this is an unchecked exception, generates arithmetic exception divide by 0. However, we can say that tried to scope defined exception of type arithmetic, arithmetic, exception of good rent. But the message. So if we go ahead and run it, you'll see that divide by 0. This is the message of this exception. There's asthmatic exception. Now, if you want to use the ArrayIndexOutOfBounds exception. So let's create an array a of size four, and that's print a, print x five. So in this case, it will generate an array index out of bound exception, since our catch block only catches the arithmetic exception. So we either change this exception here to array index out of bound exception and run it. It will say index out of bounds for length-4. Or we can say in general exception. So it doesn't matter what exception, just detach it and print the message. So this is it for ArrayIndexOutOfBounds exception. And this is it for the try and catch block. Next, we'll learn about how we can create our own exceptions. 14. Create an Exception: If we want to use an exception that is not available for us in Java, we can simply create our own exception. So to do that, we need to create the exception class. So let's say we need an exception to be thrown when a string is too long. So let's go ahead to create or exception class. Let's name it string exception. So what we should do now is to create our constructor. So this constructor is the same name, should be the same name as the class. Now we should extend the exception class, since this exception should be and a subclass in this class. So let's go ahead and create. This constructor, takes a string message and take it back to the exception class. So when we say suppose this is the exception class, since it is the parent class. So let's take the message and save it. So this is a, this is our exception. Now we need to use it. So first of all, we throw an exception just to make sure that everything is good. Now, let's say we have string name equals this long name for example. So we need now to set a condition. If this name, the length of this name is bigger than ten, then we should throw this exception, shall we say throw you string is too long exception with the message that we should choose. Let's say this is two. Now, if we go ahead and run the code, you can see that it throws an exception saying, staying is too long, exception that string, the string is too long. This is our message. So if we want to just received this message as we did with the other exceptions, we use the try and catch block. So trying to show it with an exception of girl, of type string is too long. Exception, catch it, and print only the method message. So if we go ahead and run the code, we can see this thing is too long. If we want to use the stack trace, we can just print it using print stack trace without the System.out.print. We then just press E dot print stack trace. And so we can now print the stack trace. We didn't know which line the exception occurred. So here it says class one to Java. This is our class, Java 11. This is the line 11. This is the line where this exception, good. So this is it for the exceptions. See you in the next lecture. 15. Get an input from the user: In this video, we'll learn how to get an input from the user. To do that, we'll use a scanner. Utile class. Scanner control space will get Java util scanner, which is a simple text scanner, can pass primitive types and strings using regular expressions. So we'll go ahead and deploy it. Let's name it scan. You see keyword scanner system, and this is how we input scanner. Now let's use it. So for example, if you want to get from the user and integers, for example, Let's say m dot. Now we can see all the methods available for us. One method is next end to scan the next token with the input as an integer. So let's go ahead and use it. Now. Re scanning what will, what would the user will provide us? So before that, this just print a message saying that he is an integer. So now Let's double it. So say i times two, and then the number times two. So if we take that for example, we should return 20 times two is 20. Now, if we, if the program is asking for an integer and read 10.5 for example, which is a double. It will generate an n-bit mismatch exception. This is an unchecked exception at line ten. So to fix it, as we did for the other exceptions, we just create a try and catch block. So try this. If something wrong happen, just catch the input mismatch exception. And rent. We are asking for an integer. So now concrete type 10.5, it will print, we are asking for an integer. Let's try double now. Double equal scan dot. So we have nextDouble to scan the next token of them, but as a doublet. So let's use it. Rent it, and run the code. We type 10.5, it will print 10.5. Now, if we type ten, for example, which is an integer, Java automatically convert this integer which is ten to w, then 0. Now, let's fill an array of integers using the scanner. First, find the array a of size n. We let the user decide the size of this added. So first of all, it asks the user, is size and scan it in and equal scandal. And now we have our size and we created our array. Now, fill it would use the for loop, starting with i equals 0, ending with a dot length minus one. So that next. Now what we're saying is we're going to fill all the elements in this array from i equal to 0 to i equal eight at length minus one. And then let's print it. Will print all the elements a of i with some space between that reality. So for example, we say that we want an array with size of four and provide the program will or elements that will print 2345. So this is how we felt the array. Now, let's move on to strings. First. Create a string. Name. Scandal Next. Now we have next and next time. The difference between them is that next with Andi read the next word. However, nextLine will read all of the light. So let's use at first, next line. Now. Let's print it. Name. Run the code. And we'll see multiple words. Let's just copy them and press enter. The system will print these exact words. However, if we used next on the next line and run the code and provide the problem with this input. Press Enter will only print the first word. Now also we can have an array of strings. So let's just use one example here. String names for example. Let's say we have renamed. To store them. You go ahead and create a for loop names. I put next names and print them the names of some specs. So if we say, let's just erase this and start with the string. Alex. So these are the element of the array consisted of strings. So this is it for this video. See you the next point. 16. Project: Build a Calculator!: So our project is building a calculator. Now, as we can see, at first, ask the user to enter two numbers, let's say 34. Now it will ask him to choose the operation you want to perform, let's say multiplication, to give us the answer 12. Now, it will ask us, do you want to try again? Try again. We type y, otherwise we type no. So we want to try again. So let's type to number 47. And if by mistake, we typed, for example, instead of these operations. So it will tell us, please choose one of the available operations. And we'll ask us again to enter the two numbers, 47 edition, to give us the answer. Now, if we want to try again, and also by mistake, we type D also. We say, please choose a valid answer. Why are no R n? So it will continue to say this until we choose either y, 22 to number two new numbers, for example, minus try again, know the, and. So this is basically the next video. We'll discuss it more and we'll give some hints. 17. Hints and Bonus: Basically, what we're doing in this calculator is building a while loop and asking the user to enter two numbers every time. So that's 12. So we'd need to store these two numbers and data types. After that, we're going to ask him to choose the operation he wants to perform. For example, if he chooses plus sign. So we need to compare this with each operation. And to do that will take it as a string and compare it using the.equals. After that, when it matches the operation. We should calculate and ask the user if he wants to try again, f, So he should type yes or no. And if by mistake the user typed q, for example, it should give him, please choose a valid answer. Why are no? So to do this, we need to have a while loop. While they user chooses anything other than y n. This specific line should be executed and it should ask him to try again, enter Y OR NOR. So for example, if I type two, I know that the program would ask me to enter two numbers, 1214. Here. If by mistake, I type by, for example, that will compare five, which with each operation. And a five by this obviously isn't equal to any of these operation, then it will say, please choose one of the available operations is enter two numbers. Say 1214 plus 26. Try again. No. Then the bigger, bigger wide loop will end. So this is the end. Now, another thing to modify is if we enter one and D for example. So as we can see, to generate an exception saying it is an input mismatch exception. So this is a bonus. If you wanna go ahead and try it, you can belt you, try and catch bugs. And that's this exception, asks the user to enter two new numbers because these numbers are invalid. So this is it for the project. See you next time. 18. Recap: So a quick recap on what we covered. We first installed Java and Eclipse, and then talk about primitive and non-primitive data types from integers, showed bytes, etc, to strings, arrays, classes and interfaces. Then we talked about decision-making in Java. We learned about if, if, else and switch statements and for and while loops. After that we covered exceptions. And we learn the difference between checked and unchecked exceptions. And we learn how to handle them by throwing these exceptions or using try-catch block. After that, learn how to work with users input. Classically, we created a calculator. Thank you so much. I hope it was beneficial. Next, we'll learn how to use XML and JSON in Java. How to bus them, how to use recursion lists, ArrayList, doubly and LinkedIn, and singly-linked list and animation. See you in the next class.