I'm not having any problems fixing this. I'm creating a game and I constructed a camera to follow a player when they are moving but when I use the method translate from the Graphics2D class I get a null pointer.  This problem doesn't happen all the time, sometimes when I run the game the error occurs?  All objects are created for Gr  Exception in thread "Thread-3" java.lang.NullPointerException at game.Game.render(Game.java:172) at game.Game.run(Game.java:126) at java.lang.Thread.run(Thread.java:745)   It's pointing at this line here.      g2d.translate(cam.getX(), cam.getY());     In my render method.      private void render() {     BufferStrategy bs = this.getBufferStrategy();     if (bs == null) {         this.createBufferStrategy(3);         return;     }      Graphics g = bs.getDrawGraphics();     Graphics2D g2d = (Graphics2D) g;       g.setColor(Color.BLACK);     g.fillRect(0, 0, WIDTH, HEIGHT);      g2d.translate(cam.getX(), cam.getY());            handler.render(g);      g2d.translate(-cam.getX(), -cam.getY());      if (gameState == STATE.GAME) {         hud.render(g);     } else if (gameState == STATE.MENU || gameState == STATE.HELP ||    gameState == STATE.END) {         menu.render(g);     }     g.dispose();     bs.show(); }   Any ideas?  cam is coming from this code:  public Game() {      tex = new Texture();      handler = new Handler();     hud = new HUD();     menu = new Menu(this, handler, hud);     this.addKeyListener(new KeyInput(handler));     this.addMouseListener(menu);      new Window(WIDTH, HEIGHT, "Let's Build A Game", this);      spawner = new Spawn(handler, hud);  //      loader = new BufferedImageLoader(); //      background = loader.loadImage("/level.png"); //       //      loadImageLevel(background);      cam = new Camera(0, 0);      if (gameState == STATE.MENU) {         handler.createMenuParticle();     } else {         handler.clearEnemies();     } }   This is the camera class I use.  public class Camera {  private float x, y;  public Camera(float x, float y) {     this.x = x;     this.y = y; }  public void tick(GameObject player) {     x = -player.getX() + (Game.WIDTH / 2);     y = -player.getY() + (Game.HEIGHT / 2); }  public float getX() {     return x; }  public void setX(float x) {     this.x = x; }  public float getY() {     return y; }  public void setY(float y) {     this.y = y; } }
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?
My grandparents bought a flight on United Airlines, as the one and same ticket, from Toronto, to ORD with one 55-minute layover, then to Maui. :     You won’t need to pay extra for airfare if you miss the flight, but on the other hand, you will most likely not be compensated by the airline for the incurred delay. It always depends on the amount of time, the reason for the delay and the airline’s policies. As soon as it’s weather-related, you won’t be getting a penny (and that’s normal: airlines can’t control the weather).    Yet they obviously prefer to avoid such charges from missing the 2nd flight.   Please see the titled question? Would they need to hotfoot or scamper from one gate to another, to not miss the 2nd flight? If yes to 2, can they request an airport electric shuttle cart now, before the flight? Is 3+1 spacetime as privileged as is claimed? Particularly, does proc always list the VmRSS value in kB? I can't find a solid answer on the , although it appears that it sticks to one unit. Is this proof of $\liminf E_k \subset \limsup E_k $ correct? I am wondering if my proof is correct? Thank you for whoever willing to take a look at it for me.     Proof $\liminf E_k \subset \limsup E_k $   If $\{E_k\}_{k=1}^\infty$ is a sequence of sets, we define \begin{align*} \limsup E_k &amp; = \bigcap_{j=1}^\infty\left(\bigcup_{k=j}^\infty E_k\right)\\ &amp;= \bigcap_{j=1}^\infty(E_j \cup E_{j+1} \cup \cdots)\\ &amp;= (E_1 \cup E_2 \cup \cdots) \cap (E_2 \cup E_3 \cup \cdots) \cap \cdots. \end{align*}  Therefore, $\limsup E_k$ consists of those points in $\mathbb{R}^n$ which belong to infinitely many $E_k$. \begin{align*} \liminf E_k &amp; = \bigcup_{j=1}^\infty\left(\bigcap_{k=j}^\infty E_k\right)\\ &amp;= \bigcup_{j=1}^\infty(E_j \cap E_{j+1} \cap \cdots)\\ &amp;= (E_1 \cap E_2 \cap \cdots) \cup (E_2 \cap E_3 \cap \cdots) \cup \cdots. \end{align*} Therefore, $\liminf E_k$ consists of those points in $\mathbb{R}^n$ which belong to all $E_k$ for $k \geq k_0$.  Now consider $x \in \liminf E_k$, then $x \in E_1 \cap E_2 \cap \cdots$, or $x \in E_2 \cap E_3 \cap \cdots$ and so on, that is to say, $x \in E_{k_0} \cup E_{k_0+1} \cup \dots$ for some $k_0$. More specifically, $x \in E_k \forall k \geq k_0$. Therefore, $x \in (E_1 \cup E_2 \cup \cdots) \cap (E_2 \cup E_3 \cup \cdots) \cap \cdots$, so we showed $x \in \limsup E_k$. "Install alongside" option missing. How do I install Ubuntu beside Windows using "Something Else"? If $11z^{10}+10iz^9+10iz-11 = 0$. Then possible value of $\mid z \mid,$ is If $11z^{10}+10iz^9+10iz-11 = 0$. Then possible value of $\mid z \mid,$ is  $\bf{My\; Try::}$ Given $11z^{10}+10iz^9+10iz-11 = 0\Rightarrow \displaystyle z^9 = \frac{11-10iz}{11z+10i}.$  Now Put $z = x+iy\;,$ we get $\displaystyle (x+iy)^9 = \frac{11-10i(x+iy)}{11(x+iy)+10i} = \frac{(11+10y)-10ix}{11x+i(10+11y)}$  Now i did not understand how can i solve it,  Help Required  Thanks pattern of moving electrons in wire under AC Adding dynamic graphics to an animation Bit of an issue here, trying to render this glass scene    Looks fine in the viewport, but when I hit render    Does anyone know the cause of different view port and final render, and how to fix it?  Here's my Look and you shall find (a correlation) I have several hundred measurements. Now, I am considering utilizing some kind of software to correlate every measure with every measure. This means that there are thousands of correlations. Among these there should (statistically) be a high correlation, even if the data is completely random (each measure has only about 100 datapoints).  When I find a correlation, how do I include the information about how hard I looked for a correlation, into it?   I am not at a high level in statistics, so please bear with me. How to fill in the Schengen visa application form when going to several countries? I will be traveling to France, Italy and Germany with France being my main destination. So I am applying in the French consulate for Schengen visa. I will be traveling on my own and will be staying in hotels.  I had some doubts with regards to filling the application form for Schengen visa.    Q22- Member State(s) of destination: Should I fill in all three of my destinations ? Q31 Surname and first name of the inviting person(s) in the Member State(s). If not applicable, name of the hotel(s) or temporary accommodation(s) in the Member State(s) : This field has barely a line of space to enter. Should I just enter the hotel name in France (my main destination) ?  Q32 Surname and first name of the inviting person(s) in the Member State(s). If not applicable, name of the hotel(s) or temporary accommodation(s) in the Member State(s): Same problem as Q31. Very little space. Should I just enter address of the one hotel I entered in earlier Q ? How to implement "select all" check box in HTML? Can you use another material as input to material nodes in cycles? Direct way leads to nowhere.  $$\lim_{n\rightarrow \infty} \sum^{n}_{i=1} \frac{1}{\sqrt {n^2 +i} } = \lim_{n\rightarrow \infty} \sum^{n}_{i=1} \frac{1}{n \sqrt {1 +\frac{i}{n^2}} } = $$  $$ = \lim_{n\rightarrow \infty} \frac{1}{n} \cdot \lim_{n\rightarrow \infty} \sum^{n}_{i=1} \frac{1}{\sqrt {1 +\frac{i}{n^2}} } = 0 \cdot \sum^{n}_{i=1} 1 = 0 \cdot n $$  So, I tried to apply squeeze theorem:  $$\lim_{n\rightarrow \infty} \sum^{n}_{i=1} \frac{1}{\sqrt {n^2 +i} } \leq \lim_{n\rightarrow \infty} \sum^{n}_{i=1} \frac{1}{n}  = 1$$  Could you help me to figure out the lower bound? Could it be that Goldbach conjecture is undecidable? The result closest to Goldbach conjecture is Chen's theorem [Sci. Sinica 16 157–176], the proposition ``1+2''. It is natural to ask if it is likely that under our arithmetic axioms the Goldbach conjecture is an undecidable proposition. Guaranteed lifetime of temporary in C++? Prove the map has a fixed point What are uses of the C++ construct "placement new"? "Is there" versus "Are there" Are there any questions I should be asking?   Is there any articles available on the subject?   My instinct is that in the two questions above, it should be 'are' as the subjects of the sentences (questions/articles) are plural.  However I also recall being told that the singular 'is' is valid here too, and of course see it very often in usage online, and this has left me a bit unsure.  Update: I have stumbled upon the reason for the confusion.     Is there any water?   Are there any questions?   The sentence structure is the same but of course water is not plural, although it is not singular either. [See  for more on this topic, as well as better illustrations of the final product.]  I have a document with a lot of short excerpts from another book scattered through it.  Putting frames around them looks a little too 'clean'. How can I get a 'torn page' type effect, to make it look as if the excerpt has been physically torn out of a book?  (I've occasionally seen this done in printed books, although I can't find an example right now.)  I'm not wedded to a very specific look here --  gives plenty of examples. But just to give this some frame of reference, here are some of the nicer ones:          (The strong colouration in this second example is a probably a little too distracting for actual use, although it might be interesting as an option. It's more the edge effect I'm interested in.)    Edit (again): I tried typesetting my text according to the updated versions of the answers below. Here are the results:    Or with interpolated shading: