From ggc
|
01 packagepackage is used to name the directory or folder a class is in intro;
02
03 importimport means to make the classes and/or packages available in this program fang.*;
04 importimport means to make the classes and/or packages available in this program java.awt.*;
05 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
06
07 /**
08 * All about my game.
09 * @authornull My Name Here
10 */
11 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects SoundExample extendsextends means to customize or extend the functionality of a class Game
12 {open braces start code blocks and must be matched with a close brace
13 privateprivate is used to restrict access to the current class only Sound sound=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound("DingLower.wav");
14
15 /**sets up the game*/
16 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
17 {open braces start code blocks and must be matched with a close brace
18 playSoundImmediately();
19 sound.setVolume(.2);
20 sound.loop();
21 }close braces end code blocks and must match an earlier open brace
22
23 /**handle input and game events*/
24 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
25 {open braces start code blocks and must be matched with a close brace}close braces end code blocks and must match an earlier open brace
26 }close braces end code blocks and must match an earlier open brace
|
Download/View intro/SoundExample.java