I am trying to print no of  node values in a given range in an avl tree .But when I try to run the program I get NullPointerException.  I couldn't get much help from previous questions of same topic.How can i correct it here.Here's my code of that portion:  public void range(int low, int up){     if(low &gt;up){         System.out.println("Illegal input");     }      if(this.root != null){         System.out.println(rangeS(this.root,low,up) +"");     }  }  public static int rangeS(AvlNode root,int k1 ,int k2){     int c = 0;     if(root.key &gt;= k1 &amp;&amp; root.key &lt;= k2){         c = c+1;     }     if(root.key &gt; k1 ){         rangeS(root.left,k1,k2);     }      if(root.key &lt;k2){         rangeS(root.right,k1,k2);     }     return c; }
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?
Is "can not" unambiguous? I always try to remember to use "cannot" when applicable as in "I cannot take an umbrella" (because I do not have one).  I also thought that the problem with "I can not take an umbrella" was that it was ambiguous: it could also mean that I could decide not to take an umbrella. Trying to write unambiguously most of the time, I would therefore never use it.  Now I see it claimed that it is in fact not ambiguous, and only carries the second meaning. Usually I would accept such advice at face value and start using "can not" when the second meaning is unambiguously meant, but this comes from a style guide I have other reasons not to respect very much.  Does "can not" have a single unambiguous meaning?  (I have read  but my question is more about current usage. The length of the answer to that question does confirm my prejudice a bit, though) How to check the tasks that are running at different run levels in debian? $t^3$ is never equal to Let $t$ be a real number such that $t^2=at+b$ for some positive integers $a$ and $b$. Then for any choice of positive integers $a$ and $b$, $t^3$ is never equal to: (A). $4t+3$ (B). $8t+5$ (C). $10t+3$ (D). $6t+5$  We have $t^3 = at^2+bt$ and so for (A) we have $t^3 = 4t+3 = 4(at^2+bt)+3$. I don't see how to continue since this is a cubic equation. Is there an easier way of finding a contradiction? Here is a fun integral I am trying to evaluate:  $$\int_{0}^{\infty}\frac{\sin^{2n+1}(x)}{x} \ dx=\frac{\pi \binom{2n}{n}}{2^{2n+1}}.$$  I thought about integrating by parts $2n$ times and then using the binomial theorem for $\sin(x)$, that is, using $\dfrac{e^{ix}-e^{-ix}}{2i}$ form in the binomial series.  But, I am having a rough time getting it set up correctly. Then, again, there is probably a better approach.   $$\frac{1}{(2n)!}\int_{0}^{\infty}\frac{1}{(2i)^{2n}}\sum_{k=0}^{n}(-1)^{2n+1-k}\binom{2n}{k}\frac{d^{2n}}{dx^{2n}}(e^{i(2k-2n-1)x})\frac{dx}{x^{1-2n}}$$  or something like that. I doubt if that is anywhere close, but is my initial idea of using the binomial series for sin valid or is there a better way?.  Thanks everyone. Introduction to string theory Can I publish without affiliation? Nothing shows up in the terminal when I type my password When I'm about to install a program in the terminal it wants the password:  [sudo] password for xxx:   But when I start to type my password nothing happens. What should I do? How to quickly move one layer to a different group in large Photoshop files, without dragging? 16.04 Cannot install anything from Ubuntu Software center Whenever I double click a deb file, it'd be opened in software center. However, when I click "install" button, it'd change to "installing" for a second but then turn back to "install" and nothing happens. It also says "This software comes from a 3rd party and may contain non-free components" at the bottom. I have enabled all the options in Software &amp; Updates and also tried reinstalling software center but nothing helped. I have not had to mess with mailto links much.  However I now need to add a link in the body of a mailto if it is possible.    Is there a way to add a link or to change the email opened to an html email vs a text email?  Something like:  &lt;a href="mailto:test@test.test?body=The message's first paragraph.%0A%0aSecond paragraph.%0A%0AThird Paragraph.%0A%0ALink goes here"&gt;Link text goes here&lt;/a&gt; Java; String replace (using regular expressions)? As part of a project for school, I need to replace a string from the form:  5 * x^3 - 6 * x^1 + 1   to something like:  5x&lt;sup&gt;3&lt;/sup&gt; - 6x&lt;sup&gt;1&lt;/sup&gt; + 1   I believe this can be done with regular expressions, but I don't know how to do it yet.  Can you lend me a hand?   P.S. The actual assignment is to implement a Polynomial Processing Java application, and I'm using this to pass polynomial.toString() from the model to the view, and I want do display it using html tags in a pretty way. Using exec and tee to redirect logs to stdout and a log file in the same time In a bash script, how can I redirect all standard outputs to a log file and tee the output on the screen using exec ?  log_file="$HOME/logs/install.txt-`date +'%Y-%m-%d_%H-%M-%S'`" [ -f "$log_file" ] || touch "$log_file" exec 1&gt;&gt; $log_file 2&gt;&amp;1   This code redirect all the log to the log file but not to the screen . Why doesn't the Related question list show that questions are closed? Is it appropriate to remove excessive commenting from code? I am referring to this question on SO , where there is a massive amount of commenting within the code (the question has since been edited to correct this).  Is it allowed to remove these for the sake for readability (the comments just specify some lesson details, method comments etc)? For a more comprehensive list of monitoring tools and their features, check out .   As the question states, what are the most commonly used tools used for this task and what are their strengths and weaknesses? I have made a fancy title page using titleformat and tikz, but I now face the following problem. The \chaptertitlename command returns \chaptername or \appendixname. I would like to spread the letters of the text returned by \chaptertitlename to a given length.  For example I would like to be able to call: \mycommand{\chaptertitlename}{3cm} in order to space the letters of \chaptertitlename on a total length of 3cm. How to do that ?  EDIT: This example illustrates a nearly working thing:  \documentclass[11pt]{article} \usepackage{fontspec} \newcommand{\spreadletters}[2]{\makebox[#2][s]{#1}}  \begin{document} \spreadletters{m y w o r d}{3cm} \end{document}   How to convert myword to m y w o r d ?  EDIT 2: Can someone explain me why the first work and not the second one (and how to make it work) ?  \documentclass[11pt]{book} \usepackage{fontspec} \usepackage{seqsplit} \usepackage[explicit]{titlesec}  \newcommand{\spreadletters}[2]{\makebox[#2][s]{\seqsplit{#1}}}  \begin{document} \chapter{First} \spreadletters{myword}{10cm} \linebreak % This is working \spreadletters{\chaptertitlename}{10cm} % This is not working \end{document} How do I develop black and white negatives at home? I have a question about something I'm wondering about. I've read somewhere that L'Hopitals rule can also be applied to complex functions, when they are analytic. So if have for instance:  $$ \lim_{z \rightarrow 0} \frac{\log(1+z)}{z} \stackrel{?}{=} \lim_{z \rightarrow 0} \frac{1}{(1+z)} = 1 $$  Now i'm wondering if this is correct? Also if we take $|z|&lt;1$, is it then correct?  Thanks, How do I drag and drop files into an application? Is a 1st-level spell cast using a 4th-level slot a 1st-level spell, or a 4th-level spell? As the title says: Is a 1st-level spell cast using a 4th-level slot a 1st-level spell, or a 4th-level spell?