Okay. On to Unit 2. We're going to be talking about objects and methods or objects and classes, and we will see that you've actually seen as before. You know of objects as sprites. In fact, we might have used the word object in block-based programming classes because it's so ubiquitous in it actually, sprite, object they feel like they're the same thing. So here's an image from Scratch actually that you might be familiar with. We already knew from our work in doing this that we could make our own blocks, make a block, those are called methods, or sometimes they're call functions in particular if they don't just do something that actually give a value back which didn't really do that in Scratch. In fact, we also had this as main. When the green flag is clicked that's what happens, that's the code that starts executing when we want to run our program. So in fact, since when the green flag clicked is really this what we call magic, public static void main String args thing. So whenever we run we know that this is what gets run. However, we also in our Scratch world, inside our main program, we could actually call methods that belonged elsewhere in the object. So here we could call the introduction, they'll be a whole set of things that would get done only to the introduction and then maybe we could go to play game, etc. So not only could we make those methods, we only made them so that we could use them to call things, and this brings up the concept about abstraction and we will particularly call it procedural abstraction now where a method is also called a procedure which is also sometimes called the function. Yes, sorry about that. That's some computer science again in the various languages that we've developed over time, people have come up with different words. A lot of times they mean the same thing like method and procedure, or really similar like method and function. But so what does that going to look like in Java? How are we going to call methods? Well, I'll just give you an example of one that you're going to see in this unit. We're going to use a string variable which is, by the way, an object, and we're going to put the object name which is name in this case and this dot and toUpperCase. So toUpperCase is going to be this method name. Though I'm not going to define because in this unit we're just going to use methods and use objects that have already been created, but that's the method name I want it to go out and call and do something to my name object. In this case, I wanted to, you might be able to guess, take "beth" and make it uppercase. Let's break down a few more details in this particular instruction though. So there are these parentheses after that you might have gotten used to those already. Though, that's where our parameter list lives, in this case, toUpperCase doesn't take any parameters. It doesn't need to have some information to get his job done that's the object or name. So there's my object name. This brings out a little bit of a complication is like starts looking like a lot of stuff, but really we're just looking at a new sentence structure if you will for an instruction, which is it's going to be the object name and then dot. So I put the red box around the dot because the dot really confuses students, it's not the end of the sentence like it is in English. This is just a way of separating. We're going to have the object name dot the method name, then we'll have parentheses, and if we have any parameter it'll go in there and we'll have a semicolon at the end. So again the dot is a dot not a period and so we say name dot toUpperCase. That's how we can read that. So besides being able to make methods or procedures and calling those, other things that we did in Scratch that we're going to be looking at now in Java is the ability to make a new object. So objects were sprites remember, and this was pretty different in Snap! Scratch and a lot of those languages, and that you had to actually create all the sprites that you wanted to have are all the objects that you wanted to have before the program runs. So just to show you the screenshot from Scratch because it's a little more intuitive than one from Snap! you would click down here in the bottom right underneath well where you'd have all your sprites and you could choose a new sprite. You had to do this before the program run. Here's the relationship. We're going to be using two words that students will really need to differentiate in this unit. The first is class. So when we would click create a new sprite, we would give these options of various types of sprites. We can have an apple, an Abby a name and okay, well all of these things. These are essentially different classes or different types of objects that we could have. We've used an apple on this so maybe I click on apple and that would give me a particular instance of the apple class. In this case, we already had an apple object there on the left. This is our second object created out of the apple class. Here I would click this I say I want an object of this kind of class, apple and by actually clicking on it, that is going to create a new object, new sprite, new object, and it's going to put it there so I can now use it. I'm going to have the first instance of apple and I could rename it and then I could have my second object or instance of the apple class. Now, let's talk about Snap! You can actually do all that in Snap! as well. It's a little bit more confusing with this customs idea. It's really the same thing underneath, it's just that Scratch has a slightly easier clear relationship to what we're going to be seeing in Java. However, if you've been doing let's say you did Code.org CS Principles and you were using the app lab thing, you were actually using JavaScript already. You had a block-based interface, but JavaScript itself is object-oriented and so you may be made functions. This is one that's done to create the board and again we've got the JavaScript written in text, and we can also create a function with a block. Other things that were in the Code.org that are more related to what we're going to do, you played around with strings perhaps. We're going to be doing strings here. You can see we've got the toUpperCase one just like the example that I gave, and that's just because again we were actually, if we were working with that, you are working with JavaScript which is an object-oriented language. So in this case, the object is str and then there's the dot and then toUpperCase, the method name and inside the parentheses we see there's no parameters. There we go, string object and there's our string method that were calling. If you did Mobile CSP, something very similar and you might have done more designing your own procedures like to maybe draw a hexagon. I think I got the right number of sides there. But yes, you could create your own methods or procedures using that word again and then they could have parameters.