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(): 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(): 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(): 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
Creating Uruk Hais - Huben's Wiki

Creating Uruk Hais

From Huben's Wiki
Jump to: navigation, search
(Fields Of Battle.)
 
Line 5: Line 5:
  
 
<pre>
 
<pre>
class Saruman
+
class Saruman // Saruman the White, from the tower of Orthanc at Isengard.
 
{
 
{
 
   static public void main(String[] args)
 
   static public void main(String[] args)
Line 82: Line 82:
 
String s = "example string";
 
String s = "example string";
 
</pre>
 
</pre>
a string object containing the information "Yowsa" is created somewhere in computer memory, and the variable 's' is set to that location.  Variables storing locations of objects can be called '''pointers''' or '''references'''.  We can say they ''point to''' the object or '''refer to''' the object.  The type of those variables is the type of their object's class.
+
a string object containing the information "example string" is created somewhere in computer memory, and the variable 's' is set to that location.  Variables storing locations of objects can be called '''pointers''' or '''references'''.  We can say they ''point to''' the object or '''refer to''' the object.  The type of those variables is the type of their object's class.
  
 
# What does 's' have in it?
 
# What does 's' have in it?
Line 96: Line 96:
 
Look at UrukHai.
 
Look at UrukHai.
  
# What are the instance variables?
+
# Which are the instance variables?
# What are the class variables?
+
# Which are the class variables?
 
# How can you tell class variables from instance variables?
 
# How can you tell class variables from instance variables?
 
# When I create an UrukHai object, what variables will be in it?
 
# When I create an UrukHai object, what variables will be in it?
Line 154: Line 154:
  
 
Please write in your own words:
 
Please write in your own words:
 +
# The difference between a variable of some class type and an object of that class.
 +
# What the 'new' keyword signifies.
 +
# What is the method after the 'new'?
 
# The difference between static and non-static for variables.
 
# The difference between static and non-static for variables.
 
# The difference between static and non-static for methods.
 
# The difference between static and non-static for methods.
 
# The difference between public and private for variables and methods.
 
# The difference between public and private for variables and methods.
# What the 'new' keyword signifies.
 
# The difference between a variable of some class type and an object of that class.
 
 
# Add a private instance variable to UrukHai: your choice.   
 
# Add a private instance variable to UrukHai: your choice.   
 
# Write an accessor and a modifier for the new instance variable.
 
# Write an accessor and a modifier for the new instance variable.
 
# Set the new instance variable in Saruman.main() for each of the two instances.
 
# Set the new instance variable in Saruman.main() for each of the two instances.
 
# Change the declaim method to show the new instance variable also.
 
# Change the declaim method to show the new instance variable also.
 +
# Create a third UrukHai, set all its variables, and have it declaim().  Please type everything, no cutting or pasting.

Latest revision as of 18:11, 4 October 2012

Personal tools
translate