I have created BinarySearch Tree and I have a problem inserting key and values. It says NullPointerException.  package BST;  public class Tree  {     public Node root = null;      public void insert(int key, Object obj)     {         Entry entry = new Entry(key,obj);         if(this.root==null)         {             this.root = new Node(entry, null);         }         else         {             insert(entry,this.root); //error         }     }     public void insert(Entry entry, Node temp)     {         if(((Entry) temp.getObj()).getKey() &gt; entry.getKey()) //error         {             if(temp.isLeft())                 insert(entry, temp.childLeft());             else                 temp.addLeft(entry);         }         else         {             if(temp.isRight())                 insert(entry, temp.childRight());             else                 temp.addRight(entry);         }     }//insert      public void inorderT()     {         inorderT(this.root);     }     private void inorderT(Node t)     {         if(t.isLeft())             this.inorderT(t.childLeft());         ((Entry)t.getObj()).printEntry();         if(t.isRight())             this.inorderT(t.childRight());     }      public void find(int key)     {         System.out.println("키 값이" + key + " 인 엔트리 출력하기");         find(key,root);     }     private void find(int key, Node temp)     {         Entry entry = ((Entry)temp.getObj());          if(entry.getKey()==key)         {             entry.printEntry();             return;         }         if(temp.isLeaf())         {             System.out.println("찾기 실패");             return;         }          if(entry.getKey()==key)         {             find(key, temp.childLeft());         }         else         {             find(key, temp.childRight());         }     } }   The sentences that say //error  is the problem I have. I totally don't know why it's not working BTW, I am so newbie at Java language. So don't blame me if it is a stupid question :)
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?
Formatting doubles for output in C# How do  I create a desktop wallpaper slideshow with my own set of images?   With the images coming from a pictures folder, or pre-selected With the images displayed in order, or randomly With the images changing every few minutes, or after random periods of time Is the ideal $I = \{f\mid f (0) = 0\}$ in the ring $C [0, 1]$ of all continuous real valued functions on $[0, 1]$ a maximal ideal? Is the ideal $I = \{f \mid f (0) = 0\}$ in the ring $C [0, 1]$ of all continuous real valued functions on the interval $[0, 1]$ a maximal ideal? Provide two arguments to one option using getopts In below code when I give option r then getopts requires one arguments:  while getopts ":hr::l:" opt; do     case $opt in         r ) echo "Run Numbers - argument = $OPTARG " ;;         l ) echo "Latency range - argument = $OPTARG" ;;         h ) helptext             graceful_exit ;;         * ) usage             clean_up             exit 1     esac done   But I need to pass two arguments after -r option, instead of one. Is there an easy way to do this? Show that one-sided limits always exist for a monotone function (on an interval) Show that one-sided limits always exist for a monotone function on an interval $[a,b]$.  Me attempt:  1) If a function is monotone on an interval $[a,b]$, then $f(a)\le f(x) \le f(b)$ for $x\in[a,b]$. Therefore if there exists left-hand (right-hand) limit of this function at a given point, then it must be finite. Now we must show that a both left-hand and right=hand limits exist. We use the fact that if we take a sequence $(x_n)\rightarrow c^{+} \in [a,b]$ then $f(x_n)$ is bounded and monotone and therefore it is convergent. How can I encourage Stack Overflow to rein in the 'subjective' vigilantes? Do we need a global test before post hoc tests? I often hear that post hoc tests after an ANOVA can only be used if the ANOVA itself was significant.    However, post hoc tests adjust $p$-values to keep the global type I error rate at 5%, don't they?  So why do we need the global test first?  If we don't need a global test is the terminology "post hoc" correct? Or are there multiple kinds of post hoc tests, some assuming a significant global test result and others without that assumption? What's the meaning of this present perfect sentence? If we set $A$ and $B$. Assuming that there exist an injective map from $A$ to $B$ and an injective map from $B$ to $A$. How to prove that there is a bijection between $A$ and $B$. I am starting to see a lot of people claiming that convential current is 'wrong' because Franklin made an error when he first started investigating electrostatics, and that later scientists didn't bother correcting the mistake, but preferred to keep the 'convention' (here is a classic example: )  I always thought he didn't get it wrong. He said that current is positive in the direction that positive charge flows, and vice-versa. He of course had no way to know which side of two sticks behind rubbed actually gained or lost mass. So he wasn't wrong. What were you taught?  P.S. I can't help but feel we are lucky that he got it 'backwards', because clearly many people are confused about electrostastics (including the author of that text book!) and believe electricity has to involve electrons (an unfortunate name... why couldn't they have been named negatrons...) I'm drawing a scene where the camera freely moves about the universe.  The camera class keeps track of the view (or look at) point, the position of the camera, and the up vector.  These vectors/points are then passed into gluLookAt.    Pan and zoom are nearly trivial to implement.  However, I'm finding rotation about the look at point to be much more of an issue.  I want to write a function Camera.rotate that takes 2 angles, one that rotates up/down and one that rotates left/right along an imaginary sphere that is centered about the look at point.  Is there an easy way to do this?  I've (briefly) read about quaternions, but I wanted to see if there was an easier solution given the relatively simple construction of my scene. Is this the correct use of the question mark?  Should it be at the end outside of the closing bracket?  See example below     How do we deliver it? (to the learner) Let $R$ be a commutative ring with 1, we define  $$N(R):=\{ a\in R \mid  \exists k\in \mathbb{N}:a^k=0\}$$  and  $$U(R):=\{ a\in R \mid a\mbox{ is invertible} \}.$$  Could anyone help me prove that if $a\in N(R) \Rightarrow 1+a\in U(R)$?  I've been trying to construst a $b$ such that $ab=1$ rather than doing it by contradiction, as I don't see how you could go about doing that. Does convergence in $L^p$ imply convergence almost everywhere? If I know $\| f_n - f \|_{L^p(\mathbb{R})} \to 0$ as $n \to \infty$, do I know that $\lim_{n \to \infty}f_n(x) = f(x)$ for almost every $x$? In classical logic, why is $(p\Rightarrow q)$ True if $p$ is False and $q$ is True? Proof $1+2+3+4+\cdots+n = \frac{n\times(n+1)}2$ Apparently $1+2+3+4+\ldots+n = \dfrac{n\times(n+1)}2$.  How? What's the proof? Or maybe it is self apparent just looking at the above?   PS: This problem is known as "The sum of the first $n$ positive integers". How to configure TeXnicCenter to work with Adobe Reader DC? When I building and view current file .tex the following error "Can not execute the command" shows up and the PDF is not generated.    If there are any related post, could help. Thanks a lot! Commas for multiple adjectives "IllegalFormatConversionException: d != java.lang.String" when padding number with 0s? I got my Galaxy S4 today (i337M), it's wayyy better than my old SII hehe.  I immediately removed the stock Bell firmware and put the latest snapshot available from CyanogenMod.  I'm wondering if it's possible to convert apps like S Planner, S Note, S Health to CyanogenMod.  Current stock android version available for i337M is 4.2.2. Latest Android version for CM is 4.4.  If I install CM 4.2, can I import/install the APKs and then upgrade to 4.4?  Hope you'll be able to help me :)