I'm new to Java programming. I use  java to write simple macros for my simulation tool. In the following part of the code I want to find a minimum and a maximum value in a csv file which is "whitespace" seperated.  Now, I have the problem that I get the java.lang.NullPointerException message on my output- window. Than it says that the macro playing is done.  I have some marker in the code and the output ends on this position.  Does anybody have the clue why this not work?  public void VelMinandMax (String Velocity_Data) {  velMagMax = 0.0 ;  velMagMin = 100.0 ;  FileReader fr1 = null ; BufferedReader br1 = null ; Scanner sc1 = null ;  try {     fr1 = new FileReader(Velocity_Data);     br1 = new BufferedReader(fr1);     sc1 = new Scanner(br1);       while (sc1.hasNextLine()) {         sc1.nextLine();           if (sc1.hasNextDouble()) {             double velMag = sc1.nextDouble();             double coordX = sc1.nextDouble();             double coordY = sc1.nextDouble();             double coordZ = sc1.nextDouble();               if (velMag&gt;velMagMax)                 {                 velMagMax = velMag ;                  }             if (velMag&lt;velMagMin)                  {                 velMagMin = velMag ;                   }         }     }    } catch (FileNotFoundException e) {     System.out.println ("Error : File Not Found") ; } finally {     sc1.close() ;     try {         br1.close() ;         fr1.close() ;          }     catch (IOException e2)  {         System.out.println ("IOException");          }     } }   Edit Output:  public execute MethodVol CalcVelRef VelMinandMax java.lang.NullPointerException
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?
How to design partitions for SSHD? "You're too clever a man" Find all integer solutions to $x^2+4=y^3$. How to boot from iso with Grub2/Burg boot loader Allow adding bounties from the iOS & Android app (I was surprised I couldn't find this in an existing question, so here goes)    I'd like to add a bounty to a question, but I'm too lazy to go get my computer or a web browser. I like the SE app, and want to use it to do everything. I can't find the button to add a bounty to a question.  Please add this button, I really want to be able to add bounties to questions from the app. In polar coordinate how we can get $dx\;dy=r\;dr\;d\theta$?  with these parameters:    $r=\sqrt{x^2+y^2}$ $x=r\cos\theta$ $y=r\sin\theta$  Tanks. There's a problem statement:     For each $m \in \mathbb{N}$, we construct a sequence $m_0$, $m_1$, $m_2,\dots$ denoted $S_m$, recursively via $m_0=m$ and      $$m_{i+1} = m_i + \left\lfloor \sqrt{m_i} \right\rfloor$$      for all $i \ge 0$.   Here, $\lfloor x \rfloor$ is the floor of $x$, the greatest integer less than or equal to $x$.   Hence, we have $\left\lfloor \sqrt{10} \right\rfloor=3$ and $\left\lfloor \sqrt{29} \right\rfloor=5$.      Show that for each positive integer $m$, the sequence $S_m$ contains the square of some integer.   I'm pretty certain that this can be proved with induction. I am just not quite sure what to induct on. Examining examples shows that $S_m$ always results in a perfect square eventually, though I'm not sure how to prove it. jQuery selector regular expressions How do I change my default browser? Is there an option to change my default browser for all my applications? How Can I Butcher Animals en Masse? So, my friend just implemented a bunch of new mods into his SMP server, which meant a host of new commands to play with.  I thought I'd give the /mobspawn command a few goes, and see what I could achieve.  So I headed off to the server's jail (I forget why this particular location compelled me), and gave it a few spins.    I seem to have made a bit of an error in judgement.     What can I do to get rid of this mess?  Is there a command or some other technique I can use to clear out any mobs in my immediate vicinity? How to create UEFI-only bootable USB live media? Which objects can I use in a finalizer method? wordcount with xesearch errors Finding the Public IP address in a shell script I can find my IP address using ifconfig or hostname -i command.  But how do I find my Public IP?  (I have a static public IP but I want to find it out using unix command) Do megapixels matter with modern sensor technology? Can I convert a C# string value to an escaped string literal? In C#, can I convert a string value to a string literal, the way I would see it in code? I would like to replace tabs, newlines, etc. with their escape sequences. If this code: Console.WriteLine(someString);  produces: Hello World!  I want this code: Console.WriteLine(ToLiteral(someString));  to produce: \tHello\r\n\tWorld!\r\n How is voltage always able to increase, if electrons move at the speed of light? So I have an old unlocked phone and I'd like to load up my own OS.  I've seen some mods out there.  CyanogenMod seems to be the most popular.  However, I was curious if I could just install a pure untouched version of the OS -- as distributed by Google. I seem to remember being able to download a clean compiled version of the Android OS.    Does Google distribute any binaries like this, and if not, is there someone out there that does?    Additionally, is this even worth trying?  These days is it necessary for Android to be packaged with special drivers and such for all of the different hardware out there? Probability of complete coupon set in $K$ boxes where a box has $N$ distinct coupons? Say there is a contest to collect a full set of $M$ coupons.  Each box of product has $N$ distinct coupons of the $M$ possible coupons in it, selected uniformly without replacement from the $M$ possible coupons, the same $N$ in number for all boxes.  I'm interested in the probability that after opening $K$ boxes of product I have at least one complete set of the $M$ coupons.  My attempt has been to take the probability of a coupon not being in a box, use that to determine the probability of that coupon not being in any of the $K$ boxes, and then... I get flummoxed, and don't think this is the correct approach.  I searched the site for coupon collector problems, there are a couple that deal with similar situations (multiple in a box), but with the box having coupons selected with replacement, so duplication in a box is possible.  Right now I'm using a CAS to get probability of sums of hypergeometric samples having all bins covered to check my ideas, but that's utterly impractical for other than tiny cases.   Is this not as trivial as I think it is, or is there a direct way to calculate this? rewrite access to collection to avoid "double" finding