How come dont get a NullPointerException when I call w.getX() in constructor Turtle(...) but when i call it in method getX() i do.  I'm guessing it has something to do with the public and private statements?  public class Turtle {     int x, y;     private boolean pen;     private double rikt;     private SimpleWindow w;      public Turtle(SimpleWindow w, int x, int y) {         w.moveTo(x, y);         System.out.println(w.getX());         rikt = Math.PI / 2;         pen = false;     }      public int getX() {         return w.getX();     }      public int getY() {         return w.getY();     }  }   The main looks like this:   public class TurtleDrawSquare {      public static void main(String[] args) {         SimpleWindow w = new SimpleWindow(600, 600, "TurtleDrawSquare");         Turtle t = new Turtle(w, 300, 300);         t.penDown();         for (int i = 0; i &lt; 4; i++) {             t.forward(100);             t.left(90);         }     } }
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
Are nested transactions allowed in MySQL? How can I use "." as the delimiter with String.split() in java If $A, B$ are two non empty sets of real numbers and for every $a$ from $A$ and $b$ from $B$     $a &lt; b$,   how can I prove that      $\sup A \leq \inf B$? When conducting multiple regression, when should you center your predictor variables & when should you standardize them? In some literature, I have read that a regression with multiple explanatory variables, if in different units, needed to be standardized.  (Standardizing consists in subtracting the mean and dividing by the standard deviation.)  In which other cases do I need to standardize my data?  Are there cases in which I should only center my data (i.e., without dividing by standard deviation)? New Graphics Card Preventing Boot Up How do I recover files from an USB flash drive? Possible Duplicate:          I have a USB flash drive that claims it needs to be formatted every time I put it into my computer (Windows).  Yesterday the drive was healthy and had data on it.  The data is probalby still there.  Are there any free tools to restore the drive?  If not free, what tools are known to work in this situation? Which is correct: "drive safe" or "drive safely"? When someone is going to drive their car somewhere, I always used to say "drive safely" to them. Recently I was told I should say "drive safe."    (From: )   Which one is correct?  Similarly, is "do good" correct? I just found out about the Mesh Display : Length feature in the "N" panel (thanks to ) that allows one to measure the length of a face or vertice.  But my first encounter with this tool gives me complex feelings of love and hate, see how, as I was trying to measure the aspect ratio of this TV screen, I am getting WIDTH = 20.33 and HEIGHT = 37.57.  These values seem awfully wrong, since my betrusted eyes tell me the height should be shorter than the width.    I have tried measuring the single vertices as well, to identical results. Materials for learning TikZ how to copy or backup files ignoring dot files I want to back-up all files from my laptop partitions to external HDD.  I ran, for example  cp -a /med*/ravb*/*00   /med*/ravb*/M*L*/7.3GB_CP &amp;&amp; echo "7.3GB BACKED UP PROPERLY" || echo "7.3GB FAILED TO BACK UP"   The issue is that dot files are also getting included which I don't want. What should I do so as to ignore all dot files for backing up. How do I get the Ender Dragon egg and what does it do? So I finally killed the Ender Dragon! As I was climbing the portal back to the world, I noticed that on top of the column there was an egg. So I attacked, mined, clicked and nothing happened, it just teleported away. What does the egg do and how do I get it? How is Selenium RC different from Selenium Web driver and some good pointers for a naive beginner to learn to scripting please? Thanks! What are the differences between "su", "sudo -s", "sudo -i", "sudo su"? I already read it from manual but I can't see difference..  su - change user ID or become superuser  sudo -s [command]   The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5).  If a                    command is specified, it is passed to the shell for execution.  Otherwise, an interactive shell is executed.  sudo -i disappear description in manual A nice user suggested  to . The edit, though very good and desirable, was rejected. I do not understand the reasons, and I did not find a way to contact those people who rejected it. What can I do to re-approve the edit? What are the differences between $$, \[, align, equation and displaymath? Is there a keyboard shortcut to "unselect" in Windows Explorer? If I've got a file (or files) selected in Windows Explorer, the only way I've found to "unselect" them is click with the mouse on some empty space.  I thought Esc would do this, but it doesn't. Also changing focus with Tab or Shift + Tab doesn't work; the file(s) are still selected even if focus goes to the address bar for instance.  Does anyone know of a keyboard shortcut to do this? Tweak showlabels/showkeys - wrap the label The cardinality of a language over a set of variables $V$ with $\#V= κ$ In predicate logic, to define a language, we consider the following $3$ sets:  (1) $V$, the set of variables;  (2) $F$, the sets of function symbols;  (3) $P$, the set of predicate symbols with their arities.   Now I am concidering about determine the cardinality of a language over a set with arbitary cardinality, $κ$(Note that $κ$ can be either finite, countablely infinite or uncountablely infinite ).  May I please ask:  If the cardinality of $V$, $\#V = κ$, what conditions on $V$ , $F$ and $P$ will give us a language over $V$, $F$ and $P$ with cardinality $κ$?  And may I please ask if it is the fact that if $\kappa$ is finite, then to get a language with cardinality $\kappa$ we need $(V+F+P)^{&lt;\omega}=(\kappa+F+P)^{&lt;\omega}=\kappa$, so we can never have a language of cardinality $\kappa$. I think it is something weird here. Am I wrong with something?  I had googled it but I have get nothing from websites, now I am confused. Could someone please help? Thanks so much!  EDIT: Latter I am told that in my course, the cardinality of a language refers to the set of expression instead of this of the set of strings. So now I need to consider further about when a string makes sense.  EDIT':Now I am considering that if we can find out a general way to determine the cardinality of expression, which may related to combinatorics. See this question:  Any help would be appreciate. less with "update file" like functionality I want to watch a file that gets overwritten every 5 minutes with less. How can I make less follow the new file descriptor instead of keeping the old one displayed? watch "cat file" won't do it because the file is too long to fit into one terminal window. Modular exponentiation by repeated squaring