Computer Science Fundamentals (CS153 2003S)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Back to Java Lab. On to Conditionals.
Held: Friday, 14 March 2003
Summary: Today we consider how to make objects that encapsulate values and provide capabilities.
Related Pages:
Due
Assignments:
Notes:
Rebelsky Examthan the previous one. I'll try to come up with a way to handle that issue. Next time, let me know earlier.
Overview:
Fraction class.
import ClassWhoseNameYouDontWantToTypeInFull;
/**
* A helpful introductory comment that describes the class.
*/
public class ClassName
{
// Field declarations
// Constructors
// Methods
} // class ClassName
protected
protected String name;
anywherein the class; variables are available only in the method they are declared in.
this.
public). + The type of value the method returns. You can use
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)
Point and Fraction classes are template
classes.
main method. You can
think of the main method as a combination of the script
and directory of a play. This method creates the objects that form
the initial actorsof the play that is your program. It then tells them what to do.
Thursday, 15 January 2003 [Samuel A. Rebelsky]
Friday, 14 March 2003 [Samuel A. Rebelsky]
Back to Java Lab. On to Conditionals.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 6 09:20:49 2003.
The source to the document was last modified on Fri Mar 14 08:56:06 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/2003S/Outlines/outline.32.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby