What is the possible way to scan a point in java ? Should I read point.x then point.y or can I read the two co-ordinates at once ?  import java.awt.Point; import java.util.Scanner; public class Saleelo {     public static void main(String[] args) {         int n = 5;         Scanner scan = new Scanner(System.in);         Point[] Points = new Point[60];         for (int i=0 ; i &lt; n ; i++) {             Points[i].x = scan.nextInt();             Points[i].y = scan.nextInt();             System.out.println(Points[i]);         }        } }   This what I have tried and it gives me null pointer exception
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?
Cardinality of a totally ordered union How do I create an immutable Class? What is the difference between ++i and i++? In C, what is the difference between using ++i and i++, and which should be used in the incrementation block of a for loop? Writing USB Joystick for PIC18F using MikroC Random errors on various sites when viewing main page Occasionally (very occasionally) when returning to the main page of a site by clicking on the logo I get the following message:     It was not possible to perform this tag search at this time due to an unexpected error.   This is odd because I'm not performing a tag search.  So far this has happened on both Movies &amp; TV and Cooking.  I have heard that others are getting this same message. I'm looking for the title of a Sci-Fi story (probably pre-1990) where a group is sent off into deep space and I believe unbeknownst to them it's a one-way journey.  In the course of the journey they all become very intelligent, they make psychoactive drugs from the plants on board, I recall that they discovered it's a one-way journey to test the affects of space travel, and they redesign/refit their engines and return to Earth.  Lame recall, sorry, that's all I got. Any help appreciated. What is a good use case for static import of methods? Just got a review comment that my static import of the method was not a good idea. The static import was of a method from a DA class, which has mostly static methods. So in middle of the business logic I had a da activity that apparently seemed to belong to the current class:  import static some.package.DA.*; class BusinessObject {   void someMethod() {     ....     save(this);   } }    The reviewer was not keen that I change the code and I didn't but I do kind of agree with him. One reason given for not static-importing was it was confusing where the method was defined, it wasn't in the current class and not in any superclass so it too some time to identify its definition (the web based review system does not have clickable links like IDE :-) I don't really think this matters, static-imports are still quite new and soon we will all get used to locating them.  But the other reason, the one I agree with, is that an unqualified method call seems to belong to current object and should not jump contexts. But if it really did belong, it would make sense to extend that super class.  So, when does it make sense to static import methods? When have you done it? Did/do you like the way the unqualified calls look?  EDIT: The popular opinion seems to be that static-import methods if nobody is going to confuse them as methods of the current class. For example methods from java.lang.Math and java.awt.Color. But if abs and getAlpha are not ambiguous I don't see why readEmployee is. As in lot of programming choices, I think this too is a personal preference thing.   Thanks for your response guys, I am closing the question. Horizontal spacing issue in \listoftheorems using amsthm + thmtools I am having a problem understanding displacement maps. I'm starting to think that I don't understand them at all.  Clarifying My Understanding  My understanding (which might be completely wrong), is that a displacement map is a gray-scale image whereby a value of 0.5 produces no displacement, >0.5 produces displacement in the positive direction, and &lt;0.5 produces displacement in the negative direction. This, however, does not seem to match my actual observations in Blender.  I am using a displacement map within Cycles, plugging it into the Displacement socket on the Material Output node (I am also using the new experimental adaptive subdivision and micro-vertex displacement). I note that a value of 0.5 actually produces a displacement in the positive direction, causing the whole mesh to jump up slightly, as well as creating the peaks and valleys that you would expect for >0.5 and &lt;0.5 values respectively.  This affects my entire understanding of displacement maps. Why is this happening? Why is a value of exactly 0.5 creating displacement? Further, how are you supposed to arrange and line up objects in your scene when, in rendered view, the displacement maps will push them out of position, even if those maps are only supposed to create displacement in specific areas.  The Problem in Practice  This is the problem I am having at the moment. I have a plane which is supposed to be a snowy field, and I am using a displacement map to give some depth to the snow. In rendered view, my plane jumps up significantly. This is what lead me to investigate my understanding of displacement maps, and to this question.  Additionally, what is the correct way to increase and decrease the strength of a displacement map? At the moment, I will run them through a Math node set to multiply, however, as you might imagine, this exaggerates the issue that I am complaining about above.  To be clear, however, I am not using a math node when experiencing the "jump up" for 0.5 values. This is not the source of my problem, but another aspect to it. Undo git pull, how to bring repos to old state Integral change that I don't understand If $f(t)$ is a Probability density function of a positive RV.  $\int_0^\infty\int_x^{\infty}f(t)dtdx$ Using fubini theorem should become $\int_0^\infty\int_0^{t}f(t)dxdt$  But why? Surely the answer is very simple but I don't see it. Fubini theorem allows the change of the order of integration. So it should become $\int_0^\infty\int_x^{\infty}f(t)dxdt$  but then I don't understand what meaning could have $\int_x^{\infty}dx$ What is the probability of a biased coin coming up heads given that a liar is claiming that the coin came up heads? A biased coin is tossed.   Probability of Head - $\frac{1}{8}$  Probability of Tail - $\frac{7}{8}$  A liar watches the coin toss. Probability of his lying is $\frac{3}{4}$ and telling the truth is $\frac{1}{4}$. He says that that the outcome is Head. What is the probability that the coin has truly turned Head?  My Attempt:  I used the formula: $$P(A \mid B) = \frac{P(A\cap B)}{P(B)}$$  $\ \ \ \ \ \ $P(it is head GIVEN liar said it's head) = P(it's head AND liar said it's head) / P(liar said it's head)  or, P(it is head GIVEN liar said it's head) = $\frac{ \frac{1}{8} \frac{1}{4} }{ \frac{7}{8}\frac{3}{4} + \frac{1}{8}\frac{1}{4} }$ [using a probability tree will be helpful here]  or, P(it is head GIVEN liar said it's head) = $\frac{1}{22}$  The Question: Is the method I used wrong in any way? Some others I have talked to are saying the answer will be $\frac{1}{4}$. Their reasoning is this: since the liar lies 3 times out of 4 and he said it is head, then the probability of it being head is 1/4. So who is right? What will be the answer? I need to prove that there are infinitely many numbers  of the form $x = 111....1$ such that $31\mid x$  what I tried - I wrote x as   $\sum_0^{n-1} 10^i$  I know that $(10,31) = 1 $  now I'm stuck .. any help will be appreciated Size in bytes is significantly less ( half the size) then size in MB in get info window In the get info window it says 387,037,139 bytes which is 387 MB whereas the size on disk is 716.9MB which is 716,900,000 bytes.   du -sh paramgen  result (in MiB) 684M    paramgen  Why is there such a large difference? How to prove that there exist no functions $f,g:\Bbb{R}\to\Bbb{R}$ such that $f(g(x))=x^{2018}$ and $g(f(x))=x^{2019}$? I have tried a little bit to solve the problem which goes as follows:   My intuition says that there exist no $f:\Bbb R\to\Bbb R$ such that $$f(g(x))=x^{2018}\text{ and }g(f(x))=x^{2019}.$$  Note that $$f(g(f(x)))=f(x)^{2018}\implies f(x^{2019})=f(x)^{2018}$$  Similarly, $$g(x^{2018})=g(x)^{2019}$$ Putting $x=1$ in $f(x^{2019})=f(x)^{2018}$, we get $f(1)=f(1)^{2018}$ and thus $f(1)=0$ or $f(1)=1$.  Similarly, putting $x=1$ in $g(x^{2018})=g(x)^{2019}$ we get $g(1)=g(1)^{2019}$ and thus $g(1)=0,1,-1$.  Now, I can't proceed further. Can anybody solve it? Thanks for assistance in advance. I understand that the mechanics and design of a lightsaber aren't that complicated.  Do others besides the Jedi and Sith (or their minions) make or use lightsabers?  And if they don't, why not? So before I reformatted (to get rid of Windows), I simply used this command to open documents by putting it at the end of the ~/.bashrc file:  alias commandless= 'gnome-open ./Documents/the-linux-command-line.pdf; gnome-open ./Documents/linux.odt'   But now everytime I start the terminal, it says:  bash: alias: gnome-open ./Documents/the-linux-command-line.pdf; gnome-open ./Documents/linux.odt: not found   before even typing anything in, and when I run the command nothing happens, not even error messages. Disable back button in android Kill Command in linux How do I create directory if it doesn't exist to create a file?