I'm stuck on a Null Pointer Exception problem. The tests are run through JUnit, but I didn't manage to debug properly and find out the reason of it.  Test class  ExcelActions excelActions; Excel_Import excel_import;  @Test public void addResultsToExcel() throws InterruptedException {     searchAfterLogin(); // works fine until the next method     excelActions.addToExcel();  //thats where NPE begins...     excel_import.importExcel(excelActions.addToExcel());  }   Excel Action (Webdriver part)  public class ExcelActions extends BaseAction {  public ExcelActions(WebDriver driver) { super(driver); }  public Map&lt;String, Object[]&gt; addToExcel(){      String beforeXpath_pageName = "//*[@id=\"mw-content-  text\"]/div[3]/ul/li[";     String afterXpath_pageName = "]/div[1]/a";      int rowCount ;     rowCount = 20;     Map&lt;String, Object[]&gt; data = new TreeMap&lt;String, Object[]&gt;();      for(int i = 1; i &lt;= rowCount; i++){          String actualXpath_pageName = beforeXpath_pageName + i +  afterXpath_pageName;         String pageName =  driver.findElement(By.xpath(actualXpath_pageName)).getText();         System.out.println(pageName);          data.put("" + i, new Object[]{pageName});     }     return data; } }   Excel import class  public class Excel_Import extends BaseAction {      public Excel_Import(WebDriver driver) { super(driver); }  public void importExcel(Map&lt;String, Object[]&gt; data) {     XSSFWorkbook workbook = new XSSFWorkbook();      //Create a blank sheet     XSSFSheet sheet = workbook.createSheet("Data");      //Iterate over data and write to sheet     Set&lt;String&gt; keyset = data.keySet();      int rownum = 0;     for (String key : keyset)     {         //create a row of excel sheet         Row row = sheet.createRow(rownum++);          //get object array of particular key         Object[] objArr = data.get(key);          int cellnum = 0;          for (Object obj : objArr)         {             Cell cell = row.createCell(cellnum++);             if (obj instanceof String)             {                 cell.setCellValue((String) obj);             }             else if (obj instanceof Integer)             {                 cell.setCellValue((Integer) obj);             }         }     }     try     {         //Write the workbook in file system         FileOutputStream out = new FileOutputStream(new  File("D:\\Projects\\Cucumber\\src\\main\\resources\\ImportedResults.xlsx"));         workbook.write(out);         out.close();         System.out.println("howtodoinjava_demo.xlsx written successfully on  disk.");     }     catch (Exception e)     {         e.printStackTrace();     } } }   Could you guys have a look at it?
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?
Comparing negatives: "she seems not to know" vs. "she doesn't seem to know" What is the difference in style and meaning between the following two:        She seems not to know.   She doesn't seem to know.      Is there a name to this type of construction? When I visit the reputation tab of my profile, I see a lot of stuff. I can make out some of it, but not all.   What do all the event types mean? Why do some events show an odd reputation gain or not show any reputation change at all? Why are some events sometimes highlighted in yellow? My reputation suddenly dropped, but I don't see anything. What happened? Why do some events disappear from my reputation history? Move EFI System Partition to another drive Negative pressure How is negative pressure created in a fluid system?Isn't it counter intuitive that we are reducing the pressure of a system containing no molecules(zero pressure) to a lower value? Can I download and play games from a friend's PSN account on a PS4? Understanding the definition of the order of an entire function in Ahlfors's Complex Analysis Let $f: \mathbb C \to \mathbb C$ be an entire function. The order of $f$ is defined by $$\lambda=\limsup_{r \to \infty} \frac{\log \log M(r)}{\log r}, $$ where $$M(r)=\max_{|z|=r} |f(z)| .$$  Ahlfors in his Complex Analysis claims that     "According to this definition $\lambda$ is the smallest number such that       $$M(r)\leq e^{r^{\lambda+\varepsilon}} $$ for any given $\varepsilon &gt; 0$ as soon as $r$ is sufficiently large."   Why is this true?  My attempt:  We know that $$\lambda=\lim_{\rho \to \infty} \sup_{r \geq \rho} \frac{\log \log M(r)}{\log r}. $$  From the definition of the limit we have that for any $\varepsilon&gt;0$, there exists some $\rho_0&gt;0$, such that $$\left\lvert \sup_{r \geq \rho} \frac{\log \log M(r)}{\log r}-\lambda \right\rvert \leq \varepsilon ,$$ for every $\rho \geq \rho_0$. In other words $$\frac{\log \log M(r)}{\log r} \leq \lambda+\varepsilon $$ for every $r \geq \rho_0$. From here it is easy to see that $$M(r)\leq e^{r^{\lambda+\varepsilon}}, $$ for all $r \geq \rho_0$. I cannot see why $\lambda$ is the smallest number with this property.  Thanks in advance. Imagine your college buddy is now running a multi-billion dollar company, while you're still stuck at the same white-collar day job 5 years after graduation. You chat with him and want to express the idea that you're happy for him and fancy having his lifestyle--something like "I wish I could buy a yacht and cruise around the world like you do; I'm glad you're doing really well!"  Basically, it's the feeling of envy when you take out the resentment from it. Is there a word for it?   (I thought about "admire", but found it too strong and broad) RSA: Fast factorization of N if d and e are known If the brain has no pain receptors, how come you can get a headache? I've read many years ago in books, that the brain has no nerves on it, and if someone was touching your brain, you couldn't feel a thing.  Just two days before now, I had a very bad migraine, due to a cold. It's become better now, but when I had it I felt my head was going to literally split in half, as the pain was literally coming from my brain.  So it lead me to the question: How come people can get headaches if the brain has no nerves? Why does water damage low-voltage microelectronics so easily? Everybody has had the time where water gets all over their electronics, and the whole thing gets ruined, like cell phones.  At that low of a voltage (3-5&nbsp;volts), I don't understand why it is such a short-term harm (long term makes sense - corrosion, etc.)  If an LED was in parallel with water, maybe a bit more current would be drawn, but it doesn't seem to be enough at all to short out the system, and the LED would still shine.  So what is it that permanently damages some electronics and what is the cause? What stops other benders from mastering the four elements? I've been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources.  I saw someone comment that they use it to clean up Connections, which is really scary since the only way to come as close to a guarantee that a Connection is closed is to implement try (catch) finally.    I was not schooled in CS, but I have been programming in Java professionally for close to a decade now and I have never seen anyone implement finalize() in a production system ever.  This still doesn't mean that it doesn't have its uses, or that people I've worked with have been doing it right.  So my question is, what use cases are there for implementing finalize() that cannot be handled more reliably via another process or syntax within the language?    Please provide specific scenarios or your experience, simply repeating a Java text book, or finalize's intended use is not enough, as is not the intent of this question. Why is the determinant the volume of a parallelepiped in any dimensions? For $n = 2$, I can visualize that the determinant $n \times n$ matrix is the area of the parallelograms by actually calculating the area by coordinates.  But how can one easily realize that it is true for any dimensions? Why we won't extract heat from air temperature? Possible Duplicate:          I have been downvoted for few answers of mine and the person who downvoted me did not leave any comments or reasons to say why I was downvoted. In such cases, how can I find out who has downvoted me and the reason for downvoting? $X/{\sim}$ is Hausdorff if and only if $\sim$ is closed in $X \times X$ $X$ is a Hausdorff space and $\sim$ is an equivalence relation.  If the quotient map is open, then $X/{\sim}$ is a Hausdorff space if and only if $\sim$ is a closed subset of the product space $X \times X$.  Necessity is obvious, but I don't know how to prove the other side. That is, $\sim$ is a closed subset of the product space $X \times X$ $\Rightarrow$ $X/{\sim}$ is a Hausdorff space. Any advices and comments will be appreciated. Pass by Reference / Value in C++ I would like to clarify the differences between by value and by reference.  I drew a picture     So, for passing by value,  a copy of an identical object is created with a different reference, and the local variable is assigned the new reference, so to point to the new copy  How to understand the words: " If the function modifies that value, the modifications appear also within the scope of the calling function for both passing by value and by reference "  Thanks! I guess nobody really knows the true nature of black holes, however, based on everything I know about black holes, there is a "singularity" at their center, which has finite mass but is infinitely small and thus infinitely dense.  So a black hole is really just a point mass that dramatically warps the space-time around it so that an event horizon is achieved.  What doesn't make sense to me is how a true mathematical "point" can rotate, or at least how it is even possible to determine if a point is rotating (or if it should even make a difference about whether or not it is rotating, for the same reason it would be impossible to tell if a perfect, featureless sphere were rotating (I know it would have higher rotational energy but lets assume you can't measure that because a true "point" can't attain rotational energy since it has no radius)).  The only conceptual solution I have to describe a rotating black hole would be to compare it to a rotating whirlpool, where the surface of the water is the fabric of space-time... but this is different because there is no "singularity" in a whirlpool that causes the water around it to rotate, whirlpools form from flow of water around a point (put into motion perhaps by some kid swirling water in a 2-liter bottle... it's due to an external cause), but the only thing that could cause rotation around a black hole would be the singularity itself, which doesn't make sense because, once again, how can we know if a true point is actually rotating?  Aside from everything I've said, here is what I am actually asking:  Why/how do some black holes rotate... what is the mechanism of their rotation (is analogous to a spinning point or a 3-d whirlpool, or something different)? When to use "respectively"? I have been wondering what it means when people use "respectively" in, before, and after sentences. For example:     We are looking for a babysitter to pick up and supervise our kids ages   6 and 3, respectively, on Monday and Friday.   I don't know if this person used it correctly, but if they did what does it mean? If they didn't use it properly what would be the proper usage?  Thanks in advance. Pipe sound output to file?