I know this has been told many times but I've been programming with java for about 3 weeks and I've just been having some fun making stuff. Most of the other reports people have made did not fix my problem. The screen displays but not the rect. Here is my code:  import java.awt.Rectangle; import javax.swing.JFrame; import java.awt.Color;  public class something {     public static int SCREEN_WIDTH = 500;     public static int SCREEN_HEIGHT = 500;     public static int Y = 10;     public static int X = 10;     public static int Width = 50;     public static int Height = 50;     public static Color player_color = Color.black;     public static Graphics g;      public static void screen() {         JFrame screen = new JFrame();         screen.setVisible(true);         screen.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);         screen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         screen.setTitle("test");         screen.setResizable(false);     }      public static void player() {         Rectangle r = new Rectangle(Y, X, Width, Height);         g.fillRect((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight());         g.setColor(player_color);     }      public static void main(String[] args) {         screen();         player();     } }   By the way I am using Eclipse and I think the problem means I'm using a value which has a null value? Correct me if I'm wrong.
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?
Possible Duplicate:          In  the following claim was mentioned:  $R/I \otimes_R M \cong M / IM$  So I tried to prove it. Can you help me finish my proof? Thanks!    We recall that $M \otimes_R -$ is a covariant right-exact functor that it is exact if $M$ is flat and we observe that the following is an exact sequence: $$ 0 \to IM \xrightarrow{i} M \xrightarrow{\pi} M / IM \to 0$$  $R/I$ is an $R$ module since $R/I$ is a subring of $R$ closed with respect to multiplication from $R$ but it is not necessarily flat hence we only get exactness on one side:  $$  (R/I) \otimes_R IM \xrightarrow{id \otimes i} (R/I) \otimes_R M \xrightarrow{id \otimes \pi} (R/I) \otimes_R M / IM \to 0$$  Then $$ \mathrm{Im(id \otimes \pi)} = (R/I) \otimes_R M / IM  \cong (R/I) \otimes_R M / \mathrm{Ker} (id \otimes i) $$  so we want to show two things:   (i) that $\mathrm{Ker} (id \otimes i) = \{0\}$. To this end let $r + I \otimes im \in (R/I) \otimes_R  IM $ and assume $ id \otimes i(r + I \otimes im ) = r + I \otimes im = 0 + I \otimes 0$. I'm not sure how to proceed from here.   (ii) and that $M /IM \cong (R/I) \otimes_R M / IM $  Can you help me? Thanks. Subgroups of $U(n)$ isomorphic to a direct sum of cyclic groups I'm using BibLaTeX to handle my bibliography and I want a reference to be placed in a footnote on every page where I cite the same work and have the same number. Also I want to be able to cite the same work on one page several times. The latter could be done by using  from the Joseph Wright's blog. However, it puts a reference in a footnote only once. How do I install an application from a .dmg disk image? I've downloaded Firefox and it's now sitting on my desktop as Firefox.dmg. When I double click on Firefox.dmg it opens up a window with Firefox in it so I can use it - does this mean the application has been installed?    Community Wiki'd the question because I think it's a worthwhile question to have on the site for pointing people to, it's not exactly intuitive to do and not a question I think I deserve any rep from. How can I create launcher icon for PhpStorm? Positive operator is bounded For a real Banach space $X$ let $A:X\rightarrow X^*$ be a positive operator in the sense that $(Ax)(x)\geq 0$ for all $x\in X$. Show that $A$ is bounded.   I don't know how to do that, maybe it's an application of the closed graph theorem? What is the difference between DX format and FX format lenses, and which to choose for what purpose?  What are the pros and cons of both? What are the convergent sequences in the cofinite topology I consider the co-finite topology on $\mathbb{R}$ that is $$\{G\subset \mathbb{R}, card(\mathbb{R}\setminus G)&lt;+\infty\}\cup \{\emptyset\}$$  What are the convergent sequences in this space .  thank you How can I double the newlines in an output stream I own a Nikon D40X and just the kit lens and I'm considering buying either a macro lens or some extension tubes.  I don't necessarily want to do true 1:1 macro, just some close ups of bugs, fungi and flowers. "Pick up something" or "pick something up"? Best way to reward an exceptionally good answer Have you ever gotten an answer soooo good, you wished you could give a +20 instead of +1 ?  Bounty System  That's a good mechanism, but they're not always right for this situation:   Bounties are usually associated with giving incentive to answer or draw traffic. I would expect that most users offered bounties before getting an answer, not after. Bounties are usually offered by people with plenty of reputation. "New" users should be able to reward exceptional answers too.   Thanking in a comment  A warm comment on the answer is always nice, but I'm not sure comments are intended for saying thanks - but to clarify / improve the answer itself.  So what is the recommended way to reward this truly exceptional answer?  Other suggestions?  I know there is an answer of the week blog, is there a way to nominate an answer to be there? Sometimes exceptional answers are hidden in low-interest questions that receive less traffic - so those will never be upvoted enough to become noticed.  Or maybe instead of a single blog for the entirety of SO, there should be an entire section called "Answer of the week" with more than one answer (maybe on a per-tag basis). Answers should arrive there based on manual nominations and not on upvotes so unpopular questions will not be discriminated against.  Clarification:  It's not that I'm personally against bounties - I use them plenty of times. I'm mostly concerned about what other people tend to do. I suspect the bounty post-answer reward is not used as much as it should. I believe the majority of people don't consider bounties for this purpose. $$ A $$  Light is travelling away from the absolute center of the Schwarzchild black hole (i.e. none of that spinning/stretching field) at $\ C $, and so shouldn't $\ \Delta C$ need to be greater than $\ C $ in order for the light to collapse into the black hole, therefore violating the relativistic limit of $\ C $?    It seems like light would just 'hover' right in the center of a black hole then. Because if it goes away from it, the event horizon pulls it back, and if it goes into it, the velocity change must be greater than $\ C $ which violates general relativity; so technically there's no way for the light to move away, and so it would just be still.  The thing is that the light must move at the speed of light or general relativity doesn't work. It's massless... But in the center of a black hole, if the above is true (it can't move or escape), then it is not travelling at the speed of light. So it cannot be still.  It cannot be spinning in a constant orbit either, because that would require velocity in an outward angle. And it cannot move in an outwardly fashion, only in an inwardly one.  Is it spinning in an infinitely decaying spiral towards the center?  If so what happens to it if and when it reaches the direct and complete center, i.e. The case of it being 'shot' from the center.    $$ B $$  If you shot light at an angle towards a black hole, but not directly to the center of it  then that light from the outside will eventually become the same as the light that I said was shot from the center to the outside; because in both cases, they end up in an infinitely decaying spiral.    If so it would end up exactly like the light in the above paragraph, so then we need to figure out what happens to that light to figure this one out, or vice versa.    $$ C $$  If you shot light directly towards the center of a black hole it would have no spiral to decay into, so therefore it must stop at some point in the center of a black hole. If it stops though, it loses it's momentum and violates general relativity again because it's energy "disappears".    If so then it violates conservation laws. So I'm assuming this simply is not true.    Is the light travelling into a black hole somehow still travelling at the speed of light, in every direction possible where that direction keeps it facing towards the center?  If so, why is there not a point at which the only thing left for the light to do is stay still, since all other paths would increase the distance between it and the black hole's center, and therefore become Case A. And if there isn't, what would happen if there was?  Also, if it's a time and observation answer where it supposedly takes and infinite amount of time for C to hit the center, wouldn't it be the case that the black hole is 'eating' all of the available light in the universe and keeping it in stasis?  Also, what happens in a Kerr black hole then? Does it just rip the field of time/gravity at an angle such that the light would never get closer than the center? How to compare objects by multiple fields Assume you have some objects which have several fields they can be compared by:  public class Person {      private String firstName;     private String lastName;     private String age;      /* Constructors */      /* Methods */  }   So in this example, when you ask if:  a.compareTo(b) &gt; 0   you might be asking if a's last name comes before b's, or if a is older than b, etc...  What is the cleanest way to enable multiple comparison between these kinds of objects without adding unnecessary clutter or overhead?   java.lang.Comparable interface allows comparison by one field only Adding numerous compare methods (i.e. compareByFirstName(), compareByAge(), etc...) is cluttered in my opinion.   So what is the best way to go about this? This question is from [Number Theory George E. Andrews 1-1 #3].     Prove that $$x^n-y^n=(x-y)(x^{n-1}+x^{n-2}y+\ldots+xy^{n-2}+y^{n-1}).$$   This problem is driving me crazy. $$x^n-y^n = (x-y)(x^{n-1}+x^{n-2}y+\dots +xy^{n-2}+y^{n-1)}$$  $(x^n-y^n)/(x-y) =$ the sum for the first $n$ numbers and then I added $(xy^{(n+1)-2}+y^{(n+1)-1})$ which should equal $(x^{n+1}-y^{n+1})/(x-y)$ but I can't figure it out    This is a similar problem in the book and I tried this method but it wasn't working out      $\quad$Thereom $\bf1$-$\bf2$: $\,\,\,\,$ If $\,x$ is any real number other than $1$, then $$\sum_{j=0}^{n-1}x^j=1+x+x^2+\ldots+x^{n-1}=\dfrac{x^n-1}{x-1}.$$    $\quad$Remark: $\displaystyle\sum_{j=0}^{n-1}A_j$ is shorthand for $A_0+A_1+A_2+\ldots+A_{n-1}.$     $\quad$Proof: Again we proceed by mathematical induction. If $n=1$ then $\displaystyle\sum_{j=0}^{1-1}x^j=x^0=1$ and $(x-1)/(x-1)=1$. Thus the theorem is true for $n=1$.  $\quad$ Assuming that $\displaystyle\sum_{j=0}^{k-1}x^j=(x^k-1)/(x-1)$, we find that $$ \eqalign{ \sum^{(k+1)-1}_ {j=0}x^j &amp; = \sum^{k-1}_ {j=0}x^j+x^k=\dfrac{x^k-1}{x-1}+x^k \\ &amp;= \dfrac{x^k-1+x^{k+1}-x^k}{x-1}\\ &amp;= \dfrac{x^{k+1}-1}{x-1}. }$$   Hence condition $(\rm ii)$ is fulfilled, and we have established the theorem.    $\quad$Corollary $\bf1$-$\bf1$: $\,\,$ If $\,m$ and $n$ are positive integers and if $m&gt;1$, then $n&lt;m^n.$ Proving the measure of an increasing sequence of measurable sets is the limit of the measures Why do "stripes" appear on raster? I am reprojecting a SRTM 3 arc-second raster file from WGS84 geographic coordinate system, to projected coordinate system which is using Azimuthal Equidistant projection:  gdalwarp -s_srs EPSG:4326 -t_srs "+proj=merc +lat_ts=40.81266 +lon_0=14.414252" -r near -of GTiff C:/vesuvius2_wgs84.tif C:/vesuvius2_aeqd.tif   I attached the initial raster file in here ().  The issue is that if I use the Nearest neighbor resampling method (-r near), some sort of "stripes" appear on terrain once I reproject the file to Azimuthal Equidistant projection. Here is the how the reprojected raster looks like:    And here is its 3d representation:    Interestingly similar "stripes" appear in both direction if I reproject the initial raster to UTM:  gdalwarp -s_srs EPSG:4326 -t_srs EPSG:32633 -r near -of GTiff C:/vesuvius2_wgs84.tif C:/vesuvius2_epsg32633.tif   The "stripes" go away when I use Bilinear or Cubic resampling methods (-r bilinear, -r cubic) instead of the Nearest Neighbor one.  Why do these "stripes" appear when Nearest Neighbor resampling method is used? I have a char in c#:  char foo = '2';   Now I want to get the 2 into an int.  I find that Convert.ToInt32 returns the actual decimal value of the char and not the number 2.  The following will work:  int bar = Convert.ToInt32(new string(foo, 1));   int.parse only works on strings as well.    Is there no native function in C# to go from a char to int without making it a string?  I know this is trivial but it just seems odd that there's nothing native to directly make the conversion. How Do I get into the castle walls? Since I updated to Ubuntu 17.10 a while ago, my private keys – the which I use for example to access my server via ssh – are not unlocked programmatically after login anymore.    My understanding is, that usually the seahorse client should take care of this, by asking you whether or not to store the key's password when typing them in for the first time.  My first guess was, that seahorse-daemon wasn't running for some reason, but it is:  user@Zeus:~$ ps aux | grep seahorse user    19170  0.0  0.1 432636 26564 ?        Ss   00:07   0:00 seahorse-daemon   My second guess was, that for some reason I have to delete all related passwords stored in seahorse under »Passwords->login«:    I was hoping to force the client to ask me again and then storing them again. But this didn't help either. The client does not pop up to ask me...  Then I found this question, which could be related, but did not help me:    As the management of other passwords work as expected (for example passwords for nautilus, Chromium, Nextcloud etc.) I assume the problem has to do something with ssh-agent...  Can anybody hint me in the right directions, how to solve this problem? Has anything changed in the way how GNOME handles passwords? Maybe some new fancy program failed being installed during the upgrade process?   UPDATE When I add the private key to the authentication agent again with:  ssh-add ~/.ssh/id_rsa   and try to log in, I will be asked to unlock the key only once, after that the key gets unlocked programmatically. But this works only until the next reboot. After a fresh start, I have to add the key again...