Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 860

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 839

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 839

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 839

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 834

Warning: Invalid argument supplied for foreach() in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 835

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 839

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 860

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/e5m7uo8vro0d/public_html/mediawiki/includes/MagicWord.php on line 860
The Demons Command Each Other - Huben's Wiki

The Demons Command Each Other

From Huben's Wiki
Jump to: navigation, search
Line 1: Line 1:
 
We have penetrated the mysteries of finding demon commands.  Now we must seek to use those commands, and thus control our demons.
 
We have penetrated the mysteries of finding demon commands.  Now we must seek to use those commands, and thus control our demons.
==First Call==
+
==(A) First Call==
 
Place this class into Dr.Java, save, compile and run it.
 
Place this class into Dr.Java, save, compile and run it.
 
<pre>
 
<pre>
Line 33: Line 33:
 
* Create another method, named speakThrice(), that calls speak() three times. Change main() to call speakThrice() two times.  How many times is the world saved?  Why?
 
* Create another method, named speakThrice(), that calls speak() three times. Change main() to call speakThrice() two times.  How many times is the world saved?  Why?
  
==Calling Between Classes==
+
==(B) Calling Between Classes==
 
Click the New button to start a new Java class, place this code in it, save it and compile it.
 
Click the New button to start a new Java class, place this code in it, save it and compile it.
 
<pre>
 
<pre>
Line 61: Line 61:
 
* What rule would you make to explain why sometimes you can call with just the name of a method and other times you need something more complex?
 
* What rule would you make to explain why sometimes you can call with just the name of a method and other times you need something more complex?
  
==Method Calls In Real Programs==
+
==(C) Method Calls In Real Programs==
 
It is easy to identify method calls in the toy programs on this page.  It is also easy to identify them in real programs.
 
It is easy to identify method calls in the toy programs on this page.  It is also easy to identify them in real programs.
  
Line 86: Line 86:
 
* aTypeOfSound and volume are variables that are arguments for makeSound().
 
* aTypeOfSound and volume are variables that are arguments for makeSound().
 
* sound is a variable where we store the result of animal.makeSound(aTypeOfSound, volume).
 
* sound is a variable where we store the result of animal.makeSound(aTypeOfSound, volume).
 +
* We can be calling methods of different classes by using objects of different classes to make the calls.  Notice the dot!  Just like the dot when we call with a Class name.
  
 
Let's look at some real code now.  Here is the main from a class Cryptogram:
 
Let's look at some real code now.  Here is the main from a class Cryptogram:

Revision as of 00:20, 18 September 2012

Personal tools
translate