Understanding Java Program Execution: main Method and Jar Files, Study notes of Programming Methodologies

The concept of java program execution, focusing on the 'main' method and java archive (jar) files. The instructor discusses how to create and run a java program using standard java libraries instead of acm libraries. The document also covers the process of creating a jar file, including the manifest file and the importance of the main class. It emphasizes the need for the java runtime environment to run java programs.

Typology: Study notes

2010/2011

Uploaded on 10/04/2011

hollyb
hollyb 🇺🇸

4.8

(44)

431 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programming Methodology-Lecture26
Instructor (Mehran Sahami): All right. Welcome back to – what kind of day is it going
to be in 106a? Anyone want to – fun-filled and exciting. It always is. Thanks for playing
along. So a couple quick announcements before we start. One announcement is that there
is one handout today, so several people have asked in the past, these programs that I
make in these classes are kind of cool. I would like to be able to share them with my
friends and relatives and whoever else. We're going to talk a little bit about how you do
that today and what that means underneath the hood, but the handout actually explains it
all. It's this notion of a jar file. We'll talk more about a jar file as we go along.
The graphics context, for those of you who are doing it, is due today. Just wondering,
quick show of hands, how many people entered the graphics contest. Wow. Not as many
as I would've thought. There could be a couple people who are at home, even if you don't
win of getting 100 on the final in a random drawing. So that's a good sign.
One thing I do want to check, I just heard a little bit before class that some folks were
having some trouble submitting their graphics contest because there actually might have
been an issue with the server that takes submissions. So if you submitted to the graphics
contest, whether you're in here or you happen to be watching the video, email me, and let
me know what the name of your contest entry was. That way, I know for sure that we
actually got all the contest entries that we think we had, and if we didn't get one, I can
email you back. The thing I would ask you is, if you can't email me any time this
weekend because this weekend is actually, when we're going to make the first pass
looking over all the contest entries, and then we're going to have a small pool that we'll
take to the section leaders. They will vote and give the winner. I'll announce the winner
in class next week.
I might show a demo of the winning two as well. We might do the random drawing in
class as well to see who actually gets the third coveted random drawing spot, even if you
don't win. So please email me if you entered the graphics contest, just to make sure.
One other thing with email for SCPD students, I know it's still a little too early to think
about final exams, but if you're an SCPD student, it's not too early. If you're not an SCPD
student, it's not too early, either. But for SCPD students, if you're taking the final exam, if
you plan of taking it at your sites and you're not going to come on campus to take it,
email me by 5:00 p.m. December 5, letting me know that you're taking it at your site and
the name and email of your site coordinator, just like the midterm. That way, I can get the
information to your site coordinator for the final well before the final.
If you're planning on coming on campus to take the final, you can feel free to send me an
email to say you're coming on campus. If I don't hear from you, I will assume you're
coming on campus. So you only need to email me if you're taking it at your site, so please
do that if you're an SCPD student and you plan on taking it at your site.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Understanding Java Program Execution: main Method and Jar Files and more Study notes Programming Methodologies in PDF only on Docsity!

Programming Methodology-Lecture

Instructor (Mehran Sahami): All right. Welcome back to – what kind of day is it going to be in 106a? Anyone want to – fun-filled and exciting. It always is. Thanks for playing along. So a couple quick announcements before we start. One announcement is that there is one handout today, so several people have asked in the past, these programs that I make in these classes are kind of cool. I would like to be able to share them with my friends and relatives and whoever else. We're going to talk a little bit about how you do that today and what that means underneath the hood, but the handout actually explains it all. It's this notion of a jar file. We'll talk more about a jar file as we go along.

The graphics context, for those of you who are doing it, is due today. Just wondering, quick show of hands, how many people entered the graphics contest. Wow. Not as many as I would've thought. There could be a couple people who are at home, even if you don't win of getting 100 on the final in a random drawing. So that's a good sign.

One thing I do want to check, I just heard a little bit before class that some folks were having some trouble submitting their graphics contest because there actually might have been an issue with the server that takes submissions. So if you submitted to the graphics contest, whether you're in here or you happen to be watching the video, email me, and let me know what the name of your contest entry was. That way, I know for sure that we actually got all the contest entries that we think we had, and if we didn't get one, I can email you back. The thing I would ask you is, if you can't email me any time this weekend because this weekend is actually, when we're going to make the first pass looking over all the contest entries, and then we're going to have a small pool that we'll take to the section leaders. They will vote and give the winner. I'll announce the winner in class next week.

I might show a demo of the winning two as well. We might do the random drawing in class as well to see who actually gets the third coveted random drawing spot, even if you don't win. So please email me if you entered the graphics contest, just to make sure.

One other thing with email for SCPD students, I know it's still a little too early to think about final exams, but if you're an SCPD student, it's not too early. If you're not an SCPD student, it's not too early, either. But for SCPD students, if you're taking the final exam, if you plan of taking it at your sites and you're not going to come on campus to take it, email me by 5:00 p.m. December 5, letting me know that you're taking it at your site and the name and email of your site coordinator, just like the midterm. That way, I can get the information to your site coordinator for the final well before the final.

If you're planning on coming on campus to take the final, you can feel free to send me an email to say you're coming on campus. If I don't hear from you, I will assume you're coming on campus. So you only need to email me if you're taking it at your site, so please do that if you're an SCPD student and you plan on taking it at your site.

Any questions about anything we've done so far before we dive into our next great topic? All right.

One of the things that we've done the whole time in this class is we use these things called the ACM libraries. The ACM libraries are a set of libraries that are actually created by a task force of people. The ACM is the Association of Computing Machinery. We talked about them at the very beginning of the class when we talked about these libraries. They put together some nice libraries of stuff that are really useful for teaching, which is why we use them.

Today, what I'm going to do is lift a little bit underneath the hood and talk about standard Java, which is what you would get if you didn't use the ACM libraries and you just used the standard Java libraries. Now, there's no reason why you can't continue to use the ACM libraries after this class. They're just another set of libraries that were written by a group of people that you're certainly welcome to use.

So there's no reason why you should stop using them, but there were a couple important issues related to standard Java. Now it's time for you to know. So the first thing that's related to thinking about standard Java is when you're running your programs, when you go into Eclipse and you click on the little running guy to compile your programs. It give you a list of what classes you actually might want to run.

If you only have one project, you may only get one choice, but one of the things you kind of think about is in the name surfer program, I actually have four or five different classes. How come it always knew which class to run? How come it always knew the name surfer class was the class that I actually should run? Anyone want to venture a guess?

Student: [Inaudible].

Instructor (Mehran Sahami): It's the only class with [inaudible] which is very related to an underlying issue. It's the only class that actually was extending programs. So one of the extended programs, what actually was happening in these ACM libraries is you were getting a method called main. Main is actually the place – you're old enough to see main. Main is actually the method at which Java classes actually start running.

So one of the things you should think now, you never wrote a method called main. I never saw a method called main, and you're telling me that's where Java programs actually start running. Yeah, in fact it is. It's because programs provided this main method for you. What this main method did in the program was essentially get the rest of you program running by getting a few things set up and then kicking off your run method. So you didn't actually need to worry about this.

But now you're sort of old enough to actually see what that main method is all about. So if we think about what this main method does, the header for the main method is also kind of weird. This is part of the reason why we never showed you the main method before. The header for the main method is actually public static void main, but we're not

If you think about execution actually started in main, so how did this thing actually kick off my run method? Now you're sort of old enough to see that, too. So what it actually did – let's say this was the main method is something like name surfer. So somewhere inside of a program, inside of the ACM libraries for program, we had this main method that figured out what the name of your class was. Essentially, it had a one-liner in it that would've been equivalent to this.

New name surfer dot start cards. So it's a one liner. Now you know what this means. What was it actually doing? When main started, no objects exist in the world. It's a static method. So there's no object that you're giving the main message to. Main just wakes up and says, hey, I'm main. What am I going to do? Why don't I create some object of this particular type, name surfer, which happens to scan an object, which is your program. Remember your program, as we kind of talked about, implements the run method, and actually a program underneath the hood implements the runable interface that we talked about last time, with threads. We talked about the runable interface.

All programs implement the runable interface. How do you kick off something that's runable? You say start. So what it basically did was created and object of your class, which was name surfer, and told it to start. It happened to start pass along these arguments, but you never needed to see those arguments. As a matter of fact, you never did see them because when your object was in stand shaded, it didn't expect any arguments. So the arguments actually got passed to this thing called start, which just ignored them, basically, and then started your run methods to kick everything off.

Last time when we talked about start, we talked about this in the context of threads. So we said, oh, you create a new thread, and the object that's you're going to start running, we put inside a thread. We kick the thread off with start. In this case, we're not actually creating a new thread. We're just saying we want to start executing this object I just created. It implements runable, so you'll start running from the method run, but I'm not creating it in thread. So this thing is going to execute in the same thread of execution as the entire class.

So I don't suddenly kick off something that's running in parallel with this guy. It's actually going to sequentially start name surfer, and that's the last thing this guy does. Run your whole program. Any questions about that? Kind of a funky concept, but that's basically what's going on. You should see it. We were creating an instance of your program and then just kicking it off. That's why, this whole time, we had this thing called the run method that had to be public because it was implementing the runable interface. But now you've seen main.

We could've just had main in your program to begin with and included all this code. The only reason we didn't put it in there before is because we didn't want to explain any of this stuff. In week two of the class, right after [inaudible] all holding hands and singing Kum Ba Ya. We're like, oh, it's [inaudible] the robot. Let's give Java, public static void main. Straightening args. You're like, what is going on?

We hadn't done arrays. We hadn't done classes worrying about static. We certainly hadn't done methods. We hadn't even done parameter passing. So we just waited until the end. Now you see it.

Now that we have that idea, now we can think about, okay, if this is kind of what the standard Java world is, let me think about taking this idea and using it to help me take my existing programs that I've written and pack them up into a form so I can share them with family and friends. So that's what we're going to do next. The basic concept of doing this is something that's called a jar file. You've actually seen jar files before because you've been working with something this whole time in your projects called ACM dot jar. This was just a jar file that contained all the ACM libraries.

Basically, all a jar file is, where does it get its name. It's not a big mason jar, although you can think of it like that. It stands for Java archive. That's where the name comes from. The basic idea behind the jar file is this can contain a whole bunch of different stuff. Most of the time, what it contains, is a bunch of classes in Java. You can think of this as the complied version of the classes.

You can actually put source code inside the jar if you want, but most of the time when you get a jar, it doesn't have the source code associated with it. I just has the actual dot class files, which are the compiled version of the files. So you could put source files in here if you wanted. You could put data files in here if you wanted. You could put a bunch of things in here if you want, but we're really going to focus on the case of putting classes in here.

So one of these already existed for you. It was ACM dot jar, and we're going to figure out how to actually create some of these ourselves and use them because you can actually think of them as something that's executable.

So if we come to the computer, here's name surfer. This is an actual working version of name surfer, so I'm not going to show you the rest of the files in case you're taking [inaudible]. All the code's in here, so the first thing I did in the name surfer program is I thought about, hey, I want to think of this in the standard Java world now, even though you're still using the ACM libraries. When I want to build this jar, I want to build it in a way that sort of makes it maximally portable. I can give it to someone who's over here on this PC and someone who's over here on this Mac. They don't need to have a Eclipse or anything like that. They can just run it. That's the whole point.

So the first thing I'm going to do is to introduce my friend, the main method. So basically I put in the code you just saw. I add a method, public static void main has this array of strings called args that sets the parameters. That's just the way main is always defined to be. What it's going to do is create a new name surfer object and kick it off. That's the only thing I need to add to my program. So anywhere you had some class that extended program, you would add these three lines of code to get it compliant with standard Java.

checked. That's what I want in my jar. I want basically all of my Java files or the compiled version of all of my Java files. I make sure that this is clicked. It's clicked by default. Just make export generated class files and resources. So what it's going to do is compile those Java files into their corresponding class files. That's what it's going to put in the jar.

There are other options, like I can export the Java source files if I wanted to. Then I give someone the actual source code. Most of the time, you don't want to do this if you don't want peoples sniffing through your source code. You're like, here, take the compiled – the ACM libraries, we're not going to give you the source code. Just take the ACM libraries. They're good for you.

So once we have this, we need to specify where we want to save this jar file. So that's what select export destination. They should've just said, where do you want to save it. That's the export destination. We can browse around. Basically, I've already created a folder that has all my name surfer code in it over here. I'm going to save the jar file in that same folder. So this is just in the same folder for my project called name surfer that has all of my class files in it. You can put it wherever you want, just don't forget. That's kind of the key.

I’m going to save it here. You don't need to worry about the options down here. They're just fine in the defaults that they're at. You click next. Then you come to the screen that seems like, what's going on. Export files with compile warnings. Yeah, we just want to export everything. So we just click next.

This is the most interesting part of the whole thing. What we want to do when we actually create this jar file, and this is something we only need to do when we have other jar files like the ACM libraries, we need to generate a manifest file. Basically, all a manifest file is, it's a complicated name. It sort of sounds formal. It sounds like they're on a boat, and they're like, oh, where's the passenger manifest? Really, all a manifest is – I'll show you the manifest file. It's two lines long, and then you add one line to it. It's basically just a little bit of administrative information that's kept around with your jar file so it knows what kind of stuff you're using with this jar file. That's all it is.

So what we want to do is generate the manifest file. Make sure you save the manifest in the workspace is checked, which it should be. Then you need to specify where you want to save the manifest file. The place I want to save it is basically in the same folder for my name surfer project in the name manifest. You could browse around if you wanted to, but usually the name you give it is the name of the folder that all your project stuff's in, and then the name manifest, which is going to be the actual name of the file. Any questions about that? Manifest file?

The other thing you need to do when you're specifying a jar is a jar's just a bunch of classes. It needs to know in some sense if someone ends up running this jar – you'll see that in just a second. You can run a jar – where should it start? Which class should I call its main method. That's what you specify here. Select the class of the application entry

point. It's kind of a very formal way of saying, where should I start running? So the place I want to start running, it lists to you all the classes that have a main method. Those are all the ones that can start running. Name surfer is the only one.

So I click okay. So it says the main class is name surfer. Now there's no more next buttons. Now all I can do is click finish, and I just created a jar file. You're like, oh, [inaudible] double click. Double click. We're not there yet.

There's two things that you'll notice if you look over here in the package explorer. You'll notice now we have something called a manifest file because that's where I saved it. I also have name surfer dot jar, the jar file I just created. They were both put in the same folder with my other files. That's were I wanted to save them so they happened to show up here in the package explorer. Here's the funky thing. Even though we created this manifest, and we created this jar, they don't have quite the right information that we want. So what we do is we double click on the manifest file to open it up. Here's the whole manifest file.

It's got a version, which is 1.0, and it's got the main class, which is name surfer. Why does it know the main class is name surfer? Because I told it. That's the application entry point. Just for letting me know that I told it, that's where the application starts.

There's one other thing I need. What I need to do is say, you know what, that's a good time, but you also need to use the ACM libraries. It says, you didn't tell me about the ACM libraries. You say, well, now I'm going to add the coveted third line that was talked about in the manifest file. So I'm actually going to modify the manifest file and add something called a class path.

All a class path is, it actually looks just like this, C-P. Class path just tells basically the application what other stuff were you using. Are there other jar files that you're using? So what you specify here is the name of any jar files that you're going to be using as part of your program, separated by spaces.

So I'm going to use ACM dot jar. Here's ACM dot jar over here. I'm going to use the ACM libraries, and those are all in some jar file. I'm also going to use the jar file I just created, name surfer dot jar. If I had three or more jar files, I'd list them all on the same line. So if you go and write some application some day where you're like, hey, I got this jar file for my friend. Here's this jar file I downloaded from the web, which I wouldn't encourage you to do, and there's this other job file from somewhere else. You just list them all here with space in between.

Then we save the file. That's probably the most difficult thing that people forget. So you save the file. You save the manifest file. What do you do after you do all this? Create a jar all over again. Why? Just trust me.

Here's how it's going to work. I'm going to do it a little bit different this time. Rather than going to the file menu and picking export, I'm going to take the advanced course. I'm

going to go and try to find that file. So I still need to put all that stuff here. Now this folder is something I can zip up and send it to a friend of mind. When my friend gets it, they would be like, oh, name surfer dot jar. Then they get going.

So now you can package up any program that you've written in this class. Remember to put in main. You got to go through this two-part [inaudible] the jar, export it, process, modify the manifest, create another jar, put it out there again. But you're good to go. Any questions about that? Now you can package up and share with friends.

What's even cooler than sharing with friends that you can email stuff to is sharing with friends on the web. You just have millions of friends on the web. Most of them you just don't know about, but they're probably on in the late hours of the night, looking at your web pages and things. You can actually take any files that you create here, like jar files, and make them available in a web browser.

There's one other thing I should mention, and this is kind of a little thing. Before you go and create all this stuff and send it off to your mom and dad and be like, mom, dad, breakout. Go play. It's a good time. In order for them to run your jar files, they need to have the Java run time environment installed. Remember on the second week of class where we said go to the CS106 web site. You need to download a clip. There's this thing called the JRE you also need to download.

If you have a make, the JRE in most cases is already installed. If you have Windows, it's not installed. They need to go down, and you can send them to the CS106 page and say download the JRE. Here's a copy of handout No. 5. Go ahead and install it, and then they can run your programs. Your program can't run if the computer doesn't have Java, right? It's a bunch of stuff that's going to execute Java byte code, and your computer's like, what's Java byte code? I don't know what to do with it, so it won't run. They need the Java Runtime Environment.

Now assuming someone has the JRE, they can go to a web page. You might put some page on the web that allows you to load your applet. Your applet is just a webified version of your program. So here look. It's running inside a web browser. This isn't the actual application. This is my web browser. I could go to some search engine from here. I'm sitting in the web browser. I'm not just running a regular application on my desktop. This guy's actually running in my web browser.

Here's how I make it happen. I create a web page. If you don't know about HTML and creating web pages, unfortunately I can't explain that to you in five minutes. What I can show you is basically what this file's going to look like. So if you know a little bit of HTML or you just want to essentially copy and paste this idea, this will work for you. So all you do is say – the entire page that allows your applet to run. You say this page is HTML. There's these little things called tags.

The name of that page is name surfer. I want to create a little table. I'm going to create a little border around my application. What's my application? My whole application is right

here. I have an applet. What's the name of the archive, which is a Java archive that contains my applet? It's name surfer dot jar. Code is what's the entry point. This guy no long has a manifest file available to us. What's my entry point? Name surfer dot class. That's where you start running. So it says I'm going to go name surfer dot class, find its name. That's where I start running.

The space I'm going to give you to run on the screen is 700 by 500. That little snippet of code is what goes on whatever web server this is serving on. It looks for those jar files, slaps them into the page and then they're good to go to run more java program inside their web browser. How many people know HTML? You folks. There's some number of folks that this might be a reasonable thing to do. If not, you just don't need to worry about it. It's not a big deal.

The one other thing you should know if you create a web page is that when something's running in the web page, it doesn't have access to the rest of the file system. What that means is if I actually happen to be over here – notice I have index dot HTML. I have name surfer dot jar, and I have ACM dot jar. What happens in my names dash data file? It doesn't exist. Why doesn't it exist? Because I couldn't read it anyway. Once I'm running on the web browser, for security reasons, it doesn't let you go in and pull stuff out of your file system.

If it did, people could do really bad things to your computer. So what you need to do if you want to find that data, you let us run name surfer on the web. What did you do? Here's the dirty little secret. I actually created a giant array that had all the data in it and made it part of the program. So sometimes you can do stuff like that if you don't actually want to read from a file. The other thing you can do is you can take those files and include them in the jar file because the jar file cannot only have compiled [inaudible]. It can also have data files. That's another way of doing it if you want to do it that way.

We don't have time to go into all the details. It's kind of the same process. When you're exporting stuff to the jar file, you include some data files in there. So what's creating the executable. Now that we know all this funky stuff about executables put on a web page if I want. I'm feeling happy. I'm good to go. It's time to come back to our friend, standard Java.

Standard Java's what allowed us to think about doing this stuff because we learned about main. I want to show you a couple examples of programs that actually don't use the ACM libraries at all to show you why we use the ACM libraries. One of the things you might be wondering is why weren't we just doing the standard Java thing the whole time? Part of the reason is things are just so much easier and cooler when you have the ACM libraries.

So if you go back over to Eclipse, we're kind of done with name surfer and all this manifest stuff. Here's a program that's written in standard Java that writes out hello world on the screen. This is something you kind of did in the first class by saying public class

So we have a J label that gets added to a J frame. I set the size for that J frame, which is 500 by 300. That tells me how big the window's going to be when it starts. Then there's this other stuff that I need to do. You would think why do I need to do that? It doesn't make any sense that I would not otherwise want to have it this way. Here's what I need to do.

If someone clicks close on the window, I need to say, hey, if someone clicked that, then you need to close yourself. Otherwise, the window goes away and the application keeps running. It seems odd, but we need to have that there for this application to stop running. Then we say window, I know I created you and everything. You need to make yourself visible. Otherwise, no one will be able to see you.

You're like, why would I create a window that I wasn't going to make visible? Yeah, that's why we use the ACM libraries. So we need to make sure that this guy's visibility's true. If we run this, here's graphical hello. So after all this stuff, here's graphical hello.

Yeah, would you want all that explained to you so you can get hello world? You're like, I'm writing a social network. I don't need to worry about hello world in the middle of my screen. That's because you have the ACM libraries. So you're like, okay, let's kick it up even one more notch. You're like, [inaudible] all this mouse stuff and interaction, right? That should be something I get some benefit from having standard Java. So we'll have an interactive version of hello.

Center the interactive version of hello. Now some of this stuff should begin to get a little more repetitive in the sense that you have your main. You have your J frame. The frame is called interactive hello. That's the title of that window. What we're going to add to this J frame is a new class that we're going to create called a moving label. I'll show you what a moving label down in just a second, but we need to set the size of the window, set default close operation exit on close. Set visibility to true.

Basically all this does is create this window of a particular size. It's going to add this thing called a moving label to it. Moving label's just another class I create. What's a moving label? A moving label is a J component. It needs to be a J component because I'm going to add it to a frame. To display something on a frame, I can only display components on the frame. This is going to extend component.

It's going to implement our friend, mouse listener. It's going to listen for the mouse. You're like, oh, I remember mouse listener. That where the mouse got clicked and dragged. That stuff's exactly the same. So I have my constructor. What my constructor has, it has some starting text for this label at its starting X and Y location. That should look kind of familiar to you. Basically I just store off the text. I store it at X and Y. This guy wants to listen for mouse events.

So it says add a mouse listener, and it needs to say if you get some mouse event, send them to this. So this is a little bit different than you've written in your programs before

where you just said add mouse listener. You just had an open [inaudible]. That's because we kind of took care of the rest of this stuff for you.

Here's where things get a little bit funky. The difference between this and thinking about having some sort of label that you just display on a canvas, some text that just sits there, is that this guy now has to worry about what's known as painting himself. That means it needs to draw itself on the screen.

Well, when I had labels before, they just knew how to draw themselves. Yeah, that's because we gave you a label that was a little bit smarter and knew that it was a label that should draw itself. This guy needs to be told to draw himself. There's a method called paint component that gets called whenever this guys gets displayed on the screen. There's some other thread that's going to call it for you automatically. Here's the graphics context in which your going to call yourself.

Within that graphics context, I'm going to draw some string. The actual method name and everything is not important here. It just shows you that there is extra stuff you need to worry about, which is why we didn't want to do all this stuff to begin with. This stuff you've seen before. What happens if a mouse is clicked? I get the new XY location. I repaint. What does repaint mean? It means redraw yourself. I'm going to redraw myself at this new XY location. When I call repaint, someone comes along and says, hey, to repaint this area, I'm going to call your paint component method so you can repaint yourself.

Whoa, this is really weird. I'm over here. I get a mouse click, and I know that I want to redraw myself. But rather than telling myself directly to redraw myself, I go and tell the system, I need to get repainted. Then the system says, that's the start of Jabba the Hutt kind of sitting there fat and happy. Some day, if you actually – we won't get into it.

You go and say I need to repaint myself. It says, okay, you need to repaint yourself. Well, when I'm ready for you to repaint yourself, I'll call your paint component method. Until then, you don't repaint yourself. So it delays other stuff in the system to worry about, and then oh, yeah. There was you. You asked to get repainted. I'll call your paint component. You say, okay, well, now I'm going to draw myself at the new XY location.

So it kind of convoluted the whole notion of you're doing something here, and you're asking someone else to do something for you. Then they're going to call you back to do what you originally intended to do. Now it makes a little bit more sense after we talked about threads and after you've seen all this stuff. Third day of class, not so hot.

So if we run this, this is called interactive below. Basically, what it does is it just brings up our particular message, CS106A rocks in the middle of the screen. Now every time I click the mouse button because this is the mouse click event over here. Every time I click the mouse button, the XY location of the mouse becomes the new base point for the text that gets drawn. So it just moves around the screen.

things you don't want to know. Everything you want to know and more. That's just a small set.

So these are just a few books I'd recommend if you want to go on beyond this class. But you can go into any bookstore, and you get inundated with that kind of stuff. Now you have a context for putting all the pieces together because you've seen all the things that you actually need to know to be able to work with the huge set of tools that Java actually has. Any questions about any of this stuff?

You're good to go? All right. I'll let you go a couple minutes early because most of the time, I let you go a couple minutes late. Have a good weekend.

[End of Audio]

Duration: 45 minutes