Intermediate Programmer here. Wondering what in my code is causing a NullPointerException in the Trapezoid Class.  Trapezoid is intended to be able to create the characteristics of a trapezoid using both left-side points and the top and bottom lines of a trapezoid as input. The top and bottom lines of the trapezoid are straight.  Point class:      class Point {         double pointx = 0;         double pointy = 0;     public Point(double x, double y) {         pointx = x;         pointy = y;     }     public double getX() {         double getx = pointx;         return getx;     }     public double getY() {         double gety = pointy;         return gety;     }   trapezoid class:      class Trapezoid extends Shape {         Point tl;         Point bl;         Point tr;         Point br;         double topl;         double botl;         double leftl;         double rightl;         public Trapezoid(Point topLeftPoint, Point bottomLeftPoint, double topSide, double bottomSide) {             topl = topSide;             botl = bottomSide;             leftl = Math.sqrt(Math.pow((topLeftPoint.getX()-     bottomLeftPoint.getX()),2)+Math.pow((topLeftPoint.getY()-     bottomLeftPoint.getY()),2));             tr.pointx = topLeftPoint.pointx+topl;             tr.pointy = topLeftPoint.pointy;             br.pointx = bottomLeftPoint.pointx+botl;             br.pointy = bottomLeftPoint.pointy;             rightl = Math.sqrt(Math.pow((tr.getX()-     br.getX()),2)+Math.pow((tr.getY()-br.getY()),2));         }         public Point getTopLeftPoint() {             return tl;         }         public Point getBottomLeftPoint() {             return bl;         }         public double getTopSide() {             return topl;         }         public double getBottomSide() {             return botl;         }         public double getArea() {             double area;             area = ((topl+botl)/2)*(tl.pointy-bl.pointy);             return area;         }         public double getPerimeter() {             double perimeter = topl+botl+leftl+rightl;             return perimeter;         }     }   In particular, I am getting the NullPointerException here:      tr.pointx = topLeftPoint.pointx+topl;     tr.pointy = topLeftPoint.pointy;     br.pointx = bottomLeftPoint.pointx+botl;     br.pointy = bottomLeftPoint.pointy;   Any help you are able to provide would be helpful. I am probably overlooking something very simple, but I can't seem to understand what that is.
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?
What is the difference between call and apply? Search favorite questions by tag Favorite questions on Stack Overflow I feel is highly unused feature of all the features provided on the site. (This again is my personal opinion)  I have favorited around 90 question till date and it gets very very very difficult if I want to search for a question which I remember I have favorited, which defeats the entire purpose of one favouriting a question, so here is my small suggestion.  Favorites by tags  Screen 1        Screen 2        Please share your opinions on this. How do I take the limit as $n$ goes to $\infty$ of $\frac{\sqrt{n}}{\log(n)}$? How do take this limit:  $$ \lim_{n\to\infty} \frac{\sqrt{n}}{\log(n)}$$  I have a feeling that it is infinity, but I'm not sure how to prove it. Should I use L'Hopitals Rule? I frequently login to a server, then cd into a specific directory. Is it possible to simplify these two commands into one?   ssh bob@foo   cd /home/guest   I'd like to avoid changing anything on 'foo' if possible, as I'll have to clear it with the server administrator. I use bash, but I am open to answers in other shells. Not flying the first leg of the journey – Company cancels the second-leg ticket I've a friend that booked a round-trip journey. He booked A-to-B and B-to-A. Somehow he needed to be earlier at location B, so he took a train and did not take the flight from A to B.  When he went to the airport to take the "back home" flight (B-to-A), he was informed that his ticket was canceled because he did not take the A-to-B flight. They canceled the ticket and sold it to someone else.  Is this normal? The company said it was their right to do so, and he could not get the flight back. The company was Iberia. Subgroups of Symmetric groups isomorphic to dihedral group Is $D_n$, the dihedral group of order $2n$, isomorphic to a subgroup of $S_n$ ( symmetric group of $n$ letters) for all $n&gt;2$? I'd like to understand  and its contents as to what it implies in a bit simpler terms. I am familiar with mathematics unto Calculus 1,2,3 and some linear algebra and group theory. I am familiar with that for each symmetry there is a conservation law.    Now is there a one-one correspondence between these two always? What about laws like conservation of charge?  And conservation of energy?  And conservation of mass?  Considering our view of nature was changed as Special Relativity was introduced and thus, what earlier the theorem would have asserted as mass and energy to be originating from different symmetries then how did we reconcile these two as just one symmetry? What are path and contour integrals? I am very confused on what path and contour integrals actually represent. I tried looking for an answer on Google but the only examples were related to Quantum Mechanics. For instance, real Riemann integrals can be thought as &quot;the area under the curve&quot;. What about path/contour integrals? Also, is there a difference between path and contour integrals, or are they the same thing? I've been thinking of contour integrals as path integrals where the path is a &quot;closed loop&quot;, but I'm not sure if that's the case. It's all so confusing, and not being able to visualise these concepts makes it feel like I'm just memorising formulas and theorems without any reason. I have been thinking about path integrals as integrating over a curve in three dimensions. For example, in an $xyz$ coordinate system (with $y$ pointing “up”), we have a path on the $x$-&quot;$z$&quot; plane and integrate over that path. That is, instead of integrating over and along &quot;$y=0$&quot;, we integrate over a certain path. But I don't know if this is a correct way to think of path integrals. This issue has been frustrating me a lot because I'm now studying theorems that involve path/contour integrals and I just can't understand what they really do or mean. By path integral I mean $$\int_{\gamma\vert_{[a,b]}}f(z)\hspace{0.2em}dz = \int_{a}^{b}f(\gamma(t))\cdot\gamma'(t)\hspace{0.2em}dt$$ where $f:U\subseteq\mathbb{C}\rightarrow\mathbb{C}$ is a function that satisfies all conditions for complex integration and $\gamma:[a,b]\rightarrow U\subseteq\mathbb{C}$ is at least a piece-wise regular path. Any help would be appreciated. How to get world-space matrix of any pose bone? Is there a command for getting world-space matrix of pose bones, same as obj.matrix_world for objects? I found pose_bone.matrix, but it gives weird result for me. How would you explain covariance to someone who understands only the mean? ...assuming that I'm able to augment their knowledge about variance in an intuitive fashion (  ) or by saying: It's the average distance of the data values from the 'mean' - and since variance is in square units, we take the square root to keep the units same and that is called standard deviation.  Let's assume this much is articulated and (hopefully) understood by the 'receiver'. Now what is covariance and how would one explain it in simple English without the use of any mathematical terms/formulae? (I.e., intuitive explanation. ;)  Please note: I do know the formulae and the math behind the concept. I want to be able to 'explain' the same in an easy to understand fashion, without including the math; i.e., what does 'covariance' even mean? In which scenario do I use a particular STL container? I've been reading up on STL containers in my book on C++, specifically the section on the STL and its containers. Now I do understand each and every one of them have their own specific properties, and I'm close to memorizing all of them... But what I do not yet grasp is in which scenario each of them is used.  What is the explanation? Example code is much prefered. My background and gameobjects are 2d sprites not UI images ,I want to know how to make my background scale with screen size and positions of 2d sprits on it don't change after building game (webGl) like scale canvas with screen size and anchor points in UI elements .  Before building the game   After building How can author deal with late reviews? Array with labeling columns Is there an intelligent way to label (or name) columns in a matrix? I would like to have something like  \[M=\left[\begin{array}{c|cc} 1 &amp; 2 &amp; 3\\ 4 &amp; 5 &amp; 6 \end{array}\right],N=\left[\begin{array}{c|cc} 7 &amp; 8 &amp; 9\\ 10 &amp; 11 &amp; 12 \end{array}\right]\] \[A \ B \ C \ D \ E \ F\]   where A, B,..., F are the labels (or rather names) of the first, second, ..., sixth columns, respectively. What I want is to label A be exactly below the first column, label B be below the second column, etc., of course, nicely aligned. So far I have forced some extra spaces before the labels manually, and also experimented with the \phantom command. Customizing the output of Compass sprites I need to package my Python application, its dependencies and Python into a single MSI installer. The end result should desirably be:   Python is installed in the standard location the package and its dependencies are installed in a separate directory (possibly site-packages) the installation directory should contain the Python uncompressed and a standalone executable is not required Can python be used to edit a Text Object? That is, can python code replace, for example, a single letter in a Text Object or insert a letter or string into a Text Object.  Note that I'm not talking about replacing a Text Object with some updated string, such as, object.text = "new string". I'm thinking more about having access to the Text cursor (not the mouse cursor) and positioning it on some letter that I'd like to replace.  In other words, I'd like to have the same capability during BGE play that I have when altering a Text Object in the edit mode. Service  since Mar 29th. It looks like all the new applicants are allowed to reserve appointment with USCIS for biometrics (see: )  Did anyone successfully finish biometric process at USCIS post Mar 29th? Sometimes the website does not get updated, leaving people in the dark.  This information will help the affected people to plan. How to get the pid of the last executed command in shell script? I want to have a shell script like this:  my-app &amp; echo $my-app-pid   But I do not know how the get the pid of the just executed command.  I know I can just use the jobs -p my-app command to grep the pid. But if I want to execute the shell multiple times, this method will not work. Because the jobspec is ambiguous. How do you do AppBar docking (to screen edge, like WinAmp) in WPF?