System.out.println("Hello");
On the lab machines, skip steps 1 and 2. Repeat step 3 at the start of each lecture.
On a Mac, skip step 1.
The first download on http://java.sun.com/javase/downloads
If it doesn't show up, check that you downloaded and unzipped it in step 1
new MyPicture1()
pick
method. (It is in one of the parent
classes.)images/The Road.jpg
. stripeRows
method.Picture
, pick New
subclassMyPicture2
, MyPicture3
, etc. etc.
new Classname()
optionPicture
defines useful methodspick
: Pick an image on your computergetPixels
: Get all pixels of a picture
for (Pixel pix : getPixels()) { // do something with pix }
Pixel
class defines methods getRed
,
setRed
, getGreen
, setGreen
,
getBlue
, setBlue
double green = pix.getGreen(); green = green / 2; pix.setGreen(green);
double
(for a stupid, erm, historical
reason...)VariableType variableName = initialValue;
object.methodName() object.methodName(parameterValue)
for (Pixel pix : getPixels()) { // do something with pix }
public void methodName() { // put method code here }
MyPicture2
of Picture
public void decreaseGreen() { for (Pixel pix : getPixels()) { double green = pix.getGreen(); green = green / 2; pix.setGreen(green) } }
decreaseRed
that decreases the red values
instead of the green values. decreaseRed
and
decreaseGreen
?