<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Wed May 22, 2013 6:44 pm by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Wed May 22, 2013 6:44 pm</pubDate>
  <lastBuildDate>Wed May 22, 2013 6:44 pm</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>Re: Java help</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=95457#95457</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=48037'&gt;nicephotog&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Dec 08, 2010 2:28 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      It is much better managed this way&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;Using a &amp;quot;nested subclass&amp;quot;&lt;/span&gt; so the subclass &lt;span style=&quot;font-style: italic&quot;&gt;can call any of the methods of the super class&lt;/span&gt;(does not need to notate super in the code unless preventing &amp;quot;this&amp;quot; class overridden methods of supers methods - anti ambiguity) and &lt;span style=&quot;font-style: italic&quot;&gt;has access to all methods and variables of the superclass &lt;/span&gt;it is nested in.&lt;br /&gt;
&lt;br /&gt;
In your way where both classes code is separate but in the same package level(folder)...&lt;br /&gt;
To access a class methods and variables from the class it was instantiated(started) in, requires the instantiated sub class using java.lang.reflect and java.lang.Class classForName and finding the classloader and thread. ...its excessively difficult for security restriction of access or process.&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;public class Maze&amp;#123;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ---nested--- sub class Player can be created in maze &lt;br /&gt;
// as many times as you want/require &amp;#40;on a list or Array&amp;#41;&lt;br /&gt;
public class Player&amp;#123;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#125;//end Player&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public static void main&amp;#40;String&amp;#91;&amp;#93; args&amp;#41; &amp;#123; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;new Maze&amp;#40;&amp;#41;; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125; &lt;br /&gt;
&amp;#125; &lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=95457#95457</comments>
                                        <author>nicephotog</author>
                                        <pubDate>Wed Dec 08, 2010 2:28 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=95457#95457</guid>
                                      </item>
                                      <item>
                                        <title>Re: Java help</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94474#94474</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=23984'&gt;bobthebob1234&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Thu Nov 04, 2010 1:33 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      This is some of what I have so far:&lt;br /&gt;
RunGame.java - This is run by the user hence the main method&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
public class RunGame &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public static void main&amp;#40;String&amp;#91;&amp;#93; args&amp;#41; &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;maze myMaze = new maze&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
maze.java&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
public class maze &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;private String&amp;#91;&amp;#93;&amp;#91;&amp;#93; mazeArray = new String&amp;#91;25&amp;#93;&amp;#91;25&amp;#93;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Player myPlayer = new Player&amp;#40;this&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; * Constructor for the maze. Put all +, etc into a 2d array&lt;br /&gt;
&amp;nbsp; &amp;nbsp; */&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public maze&amp;#40;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//Some code to fill the mazeArray&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//Make a player&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;int&amp;#91;&amp;#93; playerPos = this.giveSmartChord&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;myPlayer.SetPosition&amp;#40;playerPos&amp;#91;0&amp;#93;,playerPos&amp;#91;1&amp;#93;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;this.playGame&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public void drawMaze&amp;#40;&amp;#41; &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;+-----------------------------------------------+&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; My Amazing Maze game&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;+-----------------------------------------------+&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//Some more stuff&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;+-----------------------------------------------+&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;| Level &amp;#58; &amp;quot;+level+&amp;quot; | Coins &amp;#58; &amp;quot;+coins+&amp;quot; | Watch out for the H!&amp;nbsp; |&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;+-----------------------------------------------+&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public void waitForInput&amp;#40;&amp;#41; &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;Waiting for input...&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;char input = Keyboard.readChar&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//System.out.println&amp;#40;&amp;quot;You typed&amp;quot; + input&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;myPlayer.takeInput&amp;#40;input&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public void playGame&amp;#40;&amp;#41; &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;this.drawMaze&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;this.waitForInput&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;this.playGame&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
Player.java&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
public class Player &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;protected int x,y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;protected maze mazeName;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public Player&amp;#40;maze mmaze&amp;#41; &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;mazeName = mmaze;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public void takeInput&amp;#40;char input&amp;#41; &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//OOOH Look some pretty input&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;int newChordX = x;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;int newChordY = y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;switch&amp;#40;input&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;case 'g'&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//Move left, decrease x by 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;newChordX = &amp;#40;x-2&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;case 'h'&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//More right&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;newChordX = &amp;#40;x+2&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;case 'j'&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//Move up&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;newChordY = &amp;#40;y-2&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;case 'k'&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//Move down&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;newChordY = &amp;#40;y+2&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;default&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println&amp;#40;&amp;quot;I'm sorry, I don't know what to do with that&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94474#94474</comments>
                                        <author>bobthebob1234</author>
                                        <pubDate>Thu Nov 04, 2010 1:33 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94474#94474</guid>
                                      </item>
                                      <item>
                                        <title>Re: Java help</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94468#94468</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=3554'&gt;AndyBaxman&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Thu Nov 04, 2010 10:16 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      From what you say it seems like you are creating a game with a Maze and a single player.&lt;br /&gt;
&lt;br /&gt;
Possibly the best idea would be to instantiate the Player outside of the maze. While the Player uses the Maze it isn't a part of the Maze, so in strict OO methodology it shouldn't be created by the Maze.&lt;br /&gt;
&lt;br /&gt;
Possibly create a Game Class and then:&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
public void startGame&amp;#40;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;m_gameMaze = new Maze&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;m_gamePlayer = new player&amp;#40;m_gameMaze&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;m_gameMaze.initialise&amp;#40;&amp;#41;; // or whatever....&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94468#94468</comments>
                                        <author>AndyBaxman</author>
                                        <pubDate>Thu Nov 04, 2010 10:16 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94468#94468</guid>
                                      </item>
                                      <item>
                                        <title>Re: Java help</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94444#94444</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=23984'&gt;bobthebob1234&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Nov 03, 2010 5:33 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Thanks for the replys.&lt;br /&gt;
&lt;br /&gt;
checkFreeSpace() does access instance variables in maze&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Quote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;&lt;br /&gt;
I assume you mean that the Player Class is created by an instance of the Maze Class. &lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
I think so (I'm new to java and OO as you may have guessed)&lt;br /&gt;
In the maze constructor a new player is created. So when I create a maze, a player is also created at the same time.&lt;br /&gt;
&lt;br /&gt;
I will have a play with the constructor parameter, thats quite a simple idea! Thanks&lt;br /&gt;
&lt;br /&gt;
I'll also have a look at singleton patterns.&lt;br /&gt;
&lt;br /&gt;
Thanks to both of you.</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94444#94444</comments>
                                        <author>bobthebob1234</author>
                                        <pubDate>Wed Nov 03, 2010 5:33 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94444#94444</guid>
                                      </item>
                                      <item>
                                        <title>Re: Java help</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94431#94431</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=3554'&gt;AndyBaxman&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Nov 03, 2010 12:40 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I assume you mean that the Player Class is created by an instance of the Maze Class.&lt;br /&gt;
&lt;br /&gt;
If this is the case then the simplest solution would be to create a constructor in Player that takes an instance of Maze as its parameter, then store this in a Class instance variable.&lt;br /&gt;
&lt;br /&gt;
Then all you would need to do in the move method would be to call m_myMaze.checkFreeSpace();&lt;br /&gt;
&lt;br /&gt;
If there is only ever going to be one maze, then you could look at using a &lt;a href=&quot;http://www.javabeginner.com/learn-java/java-singleton-design-pattern&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Singleton pattern&lt;/a&gt;. Then you could just:&lt;br /&gt;
&lt;br /&gt;
Maze.getInstance().checkFreeSpace();&lt;br /&gt;
&lt;br /&gt;
With regard to inheritance, there, indeed, shouldn't be any as Player isn't a kind of Maze, or vice-versa.</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94431#94431</comments>
                                        <author>AndyBaxman</author>
                                        <pubDate>Wed Nov 03, 2010 12:40 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94431#94431</guid>
                                      </item>
                                      <item>
                                        <title>Re: Java help</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94424#94424</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=10074'&gt;ethernet&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Nov 03, 2010 9:02 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Does checkFreeSpace() need to access instance variables in maze?&lt;br /&gt;
&lt;br /&gt;
If you want move to be able to call checkFreeSpace(), is this method public? Depending on what checkFreeSpace() is actually doing, you could make it a static method. So you could then invoke in in player as player.checkFreeSpace() instead of invoking through an instance of player.&lt;br /&gt;
&lt;br /&gt;
Feel free to post the code!  &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt;</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94424#94424</comments>
                                        <author>ethernet</author>
                                        <pubDate>Wed Nov 03, 2010 9:02 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94424#94424</guid>
                                      </item>
                                      <item>
                                        <title>Java help</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94421#94421</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=23984'&gt;bobthebob1234&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue Nov 02, 2010 9:01 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I'm not to sure what to google so I have come here first.&lt;br /&gt;
&lt;br /&gt;
Here is the problem:&lt;br /&gt;
I have two classes, player and maze. The player object is created in the maze. In maze there is a method called checkFreeSpace and in player there is a method called move. I need the move method to use the checkFreeSpace method. Is this possible?&lt;br /&gt;
&lt;br /&gt;
There isn't any inheritance or anything so I don't think parent or super would work?&lt;br /&gt;
&lt;br /&gt;
Thanks</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94421#94421</comments>
                                        <author>bobthebob1234</author>
                                        <pubDate>Tue Nov 02, 2010 9:01 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94421#94421</guid>
                                      </item></channel></rss>