NEW: For a prettier blog interface, see the Wordpress version!

aegis.ateneo.net/cs21b

The Java Programming Language - official book from Sun Describes the Java language; technical reference

Java Programming Comprehensive

When you want to know what functions are available, look at the Java API.

In CS21B, we'll be covering the advanced topics in Java. I won't cover all the details of all the libraries; I'll just tell you how it works and I'll leave it up to you to figure it out.

Sacha's notes: People get really lost around sockets and threads, so pay special attention to those sections because (a) they're hard, and (b) they _will_ show up again and again in class. Especially the later classes. For example, in CS123, we had to

We're using 1.3 now, and that's a fair bit of a download. You could have the CS department burn you a copy on a CD to save download time. You can also get the API documentation and the Java tutorial on the same CD. Bring a CDR to F225 or pay them a little extra, if you don't have a CDR handy.

What is CS21B about? Basically, it's more programming. In CS21A, you learned how to program. In CS21B, you'll do more programming. You'll be writing programs with many objects. We'll cover things like object-oriented design - how to write programs so that they're easy to understand and maintain. Your projects will involve lots of objects which will all interact.

We'll introduce you to data structures. These are things that contain data. We'll talk about it more in CS110, but we'll introduce you to them now.

At the same time we'll teach you how to make more powerful programs, and this is where the fun begins. In 21A you learned the basic principles of programming - how to use objects, etc. In 21B, you'll learn how to use the built-in objects in Java. You'll also learn about multithreading and networking.

You can tell your friends. I think that only Ateneo teaches networking and multithreading to freshmen. Most of the time people take this up only in fourth year when they take up operating systems, but Java makes it easy. This allows us to do a lot of stuff.

We'll do a bunch of projects like before. This time we'll have more things that you'll turn in, and we'll have a couple of big projects. The last one will be a multithreaded networked multiuser application of your choice. Work in pairs and start thinking of something to do that will use threads and networking. Some ideas: network game, chat application, ...

Basically, I'll let you propose your own ideas and the whole project will be that.

So here are the projects:

Graphics and animation Robocode Visual process simulator Simple chat program Big network app

If you guys are not too comfortable with CS21A, catch up. We'll assume you know your arrays, your for loops, that sort of thing.

Sacha's note: We can do a cram review sometime soon if you guys aren't quite sure about CS. I'll see if I can dig up an old final you can retake to see what you're unclear about.

We'll cover the 1.1 event model (listeners) as well.

GRAPHICS

The paint() method (review)

The paint method takes a Graphics class. In this example you have an applet that prints "Hello" on the screen by drawing on the Graphics object.

Quick tip: If you have a class and you'd like to see its methods, type

"javap classname"

at the command prompt.

For example, to see the methods of java.util.Vector

"java java.util.Vector"

The code in paint(..) needs to redraw everything you need to draw. It doesn't remember what you needed to draw. (Note to Sir: paint(..) doesn't erase, actually - update(..) does.)

paint(..) is called by the browser. You can't call paint(..) yourself because you don't have the Graphics object, but you can call repaint() to get your program to redraw itself. That will call paint(..) for you.

The system calls paint(..) automatically when part of the window needs to be redrawn. For example, when a window is resized, paint(..) is called to redraw the new window.

For today I'll give you an exercise. Draw a person. I'll let you do it today and on Thursday we'll improve it.

--- 4:30 F227 is free, so Doc Sarmenta can do the tests.

Previous day | Next day

I'd love to hear about any questions, comments, suggestions or links that you might have. Your comments will not be posted on this website immediately, but will be e-mailed to me first. You can use this form to get in touch with me, or e-mail me at [email protected] .

Page: 2002.Sem 2.C S 21B
Updated: 2004-11-21
NOTE: ANTI-SPAM MEASURE NOW IN PLACE. Please answer the following question with the right number in order to send me your comment.
What is two minus one? (hint: one ;) )
Name:
E-mail:
URL:
Comments: