[Current] [News] [Glance] [Search] [Instructions] [Links] [Handouts] [Project] [Outlines] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [EIJ] [API]
Back to Lab: Getting Started with Java. On to Lab: Objects and Methods, Continued.
Held Wednesday, August 30, 2000
Summary
Today we move more toward the object-oriented side of Java by considering details of classes and objects. Today's class involves both discussion and hands-on work.
Notes
Overview
Fraction class.
import UsefulClass;
/**
* A helpful introductory comment that describes the class.
*/
public class ClassName
{
// Field declarations
// Constructors
// Methods
} // class ClassName
protected
protected String name;
this.
public).
void when a method doesn't return anything.
public String getName()
{
return this.name;
} // getName()
public void setName(String newName)
{
this.name = newName;
} // setName(String)
Just so you know what you're getting into, I've put together a small chart comparing Scheme to Java.
| Category | Scheme | Java |
|---|---|---|
| Size | Small | Huge |
| Syntax | Parentheses | Lots |
| Paradigms | Functional, Imperative | Object-Oriented, Imperative |
| Data Types | List, Vector, String, Number, Atom | Primitive (numbers, characters), Object, String, ... |
| Types | Implicit, Run-time | Explicit, Compile-time |
| Hurdles/Benefits | Anonymous functions; functions as data | Size; exceptions; polymorphism |
| Execution Model | Interpreted | Compiled (plus JVM interpreter) |
| Function declaration | (define name |
protection type name(typed-arguments) |
| Function call | (function arg1 ...
argn) |
object.method(arg1 ...
argn) |
| Return value from function | value |
return value |
Are there questions on the lab?
Start working on lab J2.
There will be no reflection today. Prepare to reflect on Friday.
Wednesday, 23 August 2000
Thursday, 24 August 2000
Wednesday, 30 August 2000
Back to Lab: Getting Started with Java. On to Lab: Objects and Methods, Continued.
[Current] [News] [Glance] [Search] [Instructions] [Links] [Handouts] [Project] [Outlines] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [EIJ] [API]
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2000F/Outlines/outline.04.html
Source text last modified Wed Oct 25 10:05:37 2000.
This page generated on Fri Oct 27 08:19:45 2000 by Siteweaver. Validate this page's HTML.
Contact our webmaster at rebelsky@grinnell.edu