the exception is:   Exception in thread “main” java.lang.NullPointerException      at javax.swing.ImageIcon.&lt;init&gt;(Unknown Source),  at PlayGame.setCards(PlayGame.java:42)  at PlayGame.startGame(PlayGame.java:190)  at forms.PlayGame.&lt;init&gt;(PlayGame.java:36)   this is my code  public class PlayGame extends javax.swing.JFrame {      private LogicGame logic = new LogicGame();     private ImageIcon img1;     private ImageIcon img2;       // Creates new form PlayGame     public PlayGame() {         initComponents();         startGame();     }      private void setCards() {         int[] numbers = logica.getCardNumbers();          Carta1.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[0] + ".png")));         Carta2.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[1] + ".png")));         Carta3.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[2] + ".png")));         Carta4.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[3] + ".png")));         Carta5.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[4] + ".png")));         Carta6.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[5] + ".png")));         Carta7.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[6] + ".png")));         Carta8.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[7] + ".png")));         Carta9.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[8] + ".png")));         Carta10.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[9] + ".png")));         Carta11.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[10] + ".png")));         Carta12.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[11] + ".png")));         Carta13.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[12] + ".png")));         Carta14.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[13] + ".png")));         Carta15.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[14] + ".png")));         Carta16.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[15] + ".png")));     }      public void startGame() {         if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null, "Pulse si, para jugar!. ", "Empezar Juego", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {             setCards();             hour.setVisible(false);             iniciarTiempo();         } else {             System.exit(0);         }     } }
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?
Using "utilize" instead of "use"? Site Analytics header does not show the link to "traffic sources" when in that section I was seeing the Site Analytics page (/site-analytics)  (>25K users) and also  and found out that the header is not consistent:   When in history, the header shows "history | traffic sources" When in traffic sources, the header just shows "history"   Graphically: How can I migrate a Windows 10 from BIOS/MBR boot to UEFI/GPT without reinstalling? Add a "voted to close" activity event somewhere on the user profile page Often when I vote to close, I want to go back and check the comments on the question, to see if it's been improved, to comment further, or to answer the question.  It would be helpful to add a bit of a trail so I can find those questions again. I'm suggesting adding an event to the Activity page on the user profile, because this is the logical spot for the given action.  I realize the Activity page is public, but I don't see why this content couldn't be added only for the currently logged-in user.  An alternative would be to add a new tab on the user profile page that only lists current-user content, and is not shown publicly. I'm sure there are other events, data, or statistics that could be shown here as well, so I'm certain a new tab like this wouldn't be underutilized.    One thing that could be done instead of this is to always add a comment stating why I voted to close. This works well enough, but only some of the time -- for example, if there is already a vote to close as a duplicate and a comment with a link to that duplicate, I'm not going to add a comment myself if I have nothing to add aside from a close vote.  Another way to do it would be to favourite the question. This only works well to a point since questions that get voted to close don't necessarily end up being downvoted (i.e., for my "closed favourites," I couldn't just look at the last page of my favourites).    Related: Jon Skeet  that votes to close on your own questions be shown in the Recent Activity area, which is not what I'm requesting here. Does a Vietnamese citizen need a transit visa for South Korea? I am a Vietnamese passport holder. I'm going back to Viet Nam from Montreal this December, and I will transit at Incheon Airport for a few hours. Do I need a Korean visa just for transiting, either from Montreal to Hanoi or from Hanoi back to Montreal? The reply buttons in chat shouldn't reposition themselves on pinged messages Show f is continuous on (0, ∞) iff f is continuous at 1 for a defined function. exercise: Suppose that $f:(0,∞) → R$  satisfies $f(x) - f(y) = f(x/y)$  for all $x,y$ in $(0, ∞)$ and $f(1) = 0$.   Prove f is continuous on $(0, ∞)$ if and only if f is continuous at $1$.    (proof→:) Suppose that $f:(0,∞) → R$ satisfies $f(x) - f(y) = f(x/y)$ for all $x,y$ in $(0, ∞)$ and $f(1) = 0$. Suppose f is continuous on (0,∞), then by definition f is said to be continuous at a point $a$ if for every $ε &gt; 0$  there is a $δ &gt; 0$ such that $|x-a| &lt; δ$ implies $|f(x) - f(a)| &lt; ε$.   Then suppose f is continuous at $1$, then by our defined function  f(x) - f(y) = f(x/y) , we get $|x-1| &lt; δ$ implies $|f(x) - f(1)| = |f(x) - 0| = |f(x)| =  &lt; ε$.   (proof ←) :Suppose that $f$ is continuous at $1$, then we need to show $f$ is continuous on every point $a$ on $(0, ∞)$. Thus, by definition, f is said to be continuous at a point $a$ if for every $ε &gt; 0$ there is a $δ &gt; 0$ such that $|x-a| &lt; δ$ implies $|f(x) - f(a)| &lt; ε$. Thus, $|x-a| &lt; δ → |f(x) - f(a)| = |f(x/a)| &lt; ε$. Then $f$ is continuous on on $(0, ∞)$.  Please can anyone please help me verify this makes sense. If not, can someone please give any feedback/hints. Thank you in advance. when is this series convergent. Let $(x,y)\in \mathbb{R^2}$ and consider the series   $$\lim_{n\rightarrow \infty}\sum_{\ell,\,k=0}^n \frac{k^2 x^k y^\ell}{\ell!}$$  Then for what values $(x,y)$ the series converges. I have absolutely no idea how to deal with it. How do I use reflection to call a generic method? My understanding is that when using a Bayesian approach to estimate parameter values:   The posterior distribution is the combination of the prior distribution and the likelihood distribution. We simulate this by generating a sample from the posterior distribution (e.g., using a Metropolis-Hasting algorithm to generate values, and accept them if they are above a certain threshold of probability to belong to the posterior distribution). Once we have generated this sample, we use it to approximate the posterior distribution, and things like its mean.   But, I feel like I must be misunderstanding something. It sounds like we have a posterior distribution and then sample from it, and then use that sample as an approximation of the posterior distribution. But if we have the posterior distribution to begin with why do we need to sample from it to approximate it? dpkg: error: dpkg status database is locked by another process I just wondered if somebody could tell me what this means:  E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. reidsr@ubuntu:~$ sudo dpkg --configure -a dpkg: error: dpkg status database is locked by another process reidsr@ubuntu:~$    How do I run sudo dpkg --configure -a  manually? "Never say die?" What's the deal with this idiom? I know what it means, but cannot wrap my head around its grammar structure. The sentence structure of     "Never say die"   looks like that of     "Never admit defeat"   but it does not make the same grammatical+semantical sense.  Is it an archaic use? Is it a contraction of a longer phrase? Was it originally misspoken by someone of note and survived memetically? What are its roots?  Edit: Well, the comments made me realize that I worded my question poorly. I'm not saying I think this phrase is ungrammatical. I'm asking how the heck "saying 'die'" came to mean what it means. Product of square of distances from vertices of a polygon of radius a I want to find out the following product.  $\prod_0^{n-1}  (r^2 + a^2 -2ra\cos(2k\pi/n - \theta))$ I have been trying to use complex numbers but did not work out. The book I am reading the result is directly stated as $r^{2n} + a^{2n} -2r^na^n\cos(\theta)$. Please help. How to prove that $4^m + 5^m$ is divisible by 9 when m is an odd number I am trying to use congruence theorems, specifically Euler's Theorem for a proof. jQuery animate backgroundColor I am trying to animate a change in backgroundColor using jQuery on mouseover.  I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error. The element I am working with is a div.  $(".usercontent").mouseover(function() {     $(this).animate({ backgroundColor: "olive" }, "slow"); });   Any ideas? What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally? How can I "group by" and sum a column in excel? I'm trying to figure out how to "group by" values in an Excel spreadsheet.  Given the following example (this is an inventory sheet I use at my restaurant:)    At the far right of the spreadsheet there is a column named Cost of Goods Sold.  I would like to be able to come up with a total COGS figure for each Category.  Is this possible in excel? Moreover, I'd like to do it in a separate worksheet so that the first worksheet (what is pictured) isn't affected.  Any ideas?  Thanks! I'm a computer student, learning math just for fun. Today I was  that I found something strange! I noticed that that wired function ${x^{x^{\cdot^{\cdot^{x}}}}}$ in zero, seems to converge to 1 when there are even powers and to 0 when there are odd powers! Then I attempt to prove it but I failed.  Then I did a little research and I found the  article on Wikipedia. This article says that my guess was right but without any proof. So I'm here to ask you about it.     If we define ${x^{x^{\cdot^{\cdot^{x}}}}}$ as ${^{n}x} :=\begin{cases} 1 &amp;\text{if }n=0 \\ x^{\left(^{(n-1)}x\right)} &amp;\text{if }n&gt;0 \end{cases}$      then prove:      $$\lim_{x\rightarrow0} {}^{n}x = \begin{cases}   1, &amp; n \text{ even} \\  0, &amp; n \text{ odd} \end{cases}$$ Latexmk can't see a dependency on a .fmt format file This question isn't so much about how to achieve the effect of making a scene look like it's modelled in miniature, but why tilting the focal plane creates the effect. What is it about photographing miniatures that makes them look like miniatures, and how is this replicated by tilting the focal plane?  I can understand how when photographing a model of a scene, you have a much higher magnification, which leads to a shallower depth of field compared to when capturing the real-sized scene, but how does tilting the focal plane help? Is it just that you have the focal plane tilted relative to the plane that most of your subject is on, so that you can achieve a narrower depth of field for the focal length and aperture, or is there more to it than that?