This is a javahang man project! using java swing, I was looking for some help as i'm pretty tripped up! I get an error that leads back to line 95!  Exception in thread"AWT-EventQueue-0"  java.lang.NullPointerException     at hangmanP.DetailsPanel.textFile(DetailsPanel.java:95)  yet my IDE says that its just fine yet the console gives me this error upon running it! Any and all help would be awesome.   package hangmanP;  import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.List; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Random;  import javax.swing.*;  public class DetailsPanel extends JPanel {     public Random rGen = new Random();     private static final String FILE = null;     public static String[] words;      public DetailsPanel() {         Dimension size =  getPreferredSize();         size.width = 200;         setPreferredSize(size);          words = textFile();           setBorder(BorderFactory.createTitledBorder("Letters Guessed"));          //Adds Compnents          JLabel LetterLabel = new JLabel("Letters: " + words);         JLabel UserLetter = new JLabel("A");          JTextField User = new JTextField(1);          JButton btnSub = new JButton("Submit!");           //sets layout of sidebar         setLayout(new GridBagLayout());          GridBagConstraints gc = new GridBagConstraints();          //// First Column ///////////////////           //think of it like dividing your panel into a grid         gc.weightx = 0.5;         gc.weighty = 0.5;         gc.gridx = 0;         gc.gridy = 0;          add(LetterLabel, gc);           gc.gridy = 1;      }       public String getword() {     words = textFile();      int n = words.length;     int r = rGen.nextInt(n);     String word = words[r];              return word;     }        public String[] textFile() {          BufferedReader reader = null;          ArrayList&lt;String&gt; wordlist = new ArrayList&lt;String&gt;();          try{              reader = new BufferedReader(new InputStreamReader(new FileInputStream(FILE)));             String s = null;             while ((s = reader.readLine()) != null) {                 wordlist.add(s);             }         }              catch (IOException e) {                     System.out.println(e.getMessage());                     System.exit(-1);                 } finally {                     try {                         // close the file                         reader.close();                     } catch (IOException e) {                         System.out.println(e.getMessage());                         System.exit(-1);                     }                 }                 // convert from arraylist to array and return                 return wordlist.toArray(new String[wordlist.size()]);            } }
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?
Adding Basemaps from Google or Bing in QGIS ArcGIS Desktop has the option of using basemaps from ArcGIS Online. Does QGIS have any such options? The [ifs] tag is used for 2 separate things I think  might correspond to IBM's  according to this .   But currently out of the 27 question tagged with , most of it have to do with the 's "Internal Field Separator".  What should be done here?   create a new tag for "Internal Field Separator" e.g. , and keep the IBM's under ? create a new tag for "Integrated File System" e.g. , and keep the other one under ? just remove the  tag from the  questions? Why is my iron ore disappearing when mined with a wooden pickaxe? I am on Peaceful mode, and I am using a Wooden Pickaxe. Whenever I mine Iron Ore, it just disappears. Am I doing something wrong? Why is the Apps flash storage so high and how can it be reduced? This is the disk storage info:    This is the Applications folder info:    Why is the storage usage so high and how can it be reduced? This is on a MacBook Pro Retina 13" with OSX 10.9.5.  Edit: I had tried all the suggestions made by @user3439894 in his answer but didn't mention it before posting. How do I create a very long delay with Redstone? Is "Software Engineering" the replacement of "Programmers"? What are all the correct answers to the Squirrel's questions, and what is the reward when I get them all correct? I encountered The Squirrel at "A tree."              |   |                                                                         |   |                     "   Hello, I'm The                        |             |                        Squirrel. I can                        |             |                      provide you candies,                     |             |                      and lots of things.                                    |                      I know how much you                                    |        _.-'''-,      love candies. But I                                    |      .'        `\     feel alone in this                                    |     /           /          forest.       "                         |        |    /      .--^_^                                                   |        |    |     /  C ,,\                                                           |    |    |   \  _.)                           ___                            |     \   |   /  \                   ____.----'.-'                            |      '-, \./ \)\)               .-' --  __.-'                   |            \        `-/   );/           ___/  - _.-'                        |             \_________''--'-'________.-' --    /                            |              -   --        -  -     -     __.-'                                              -    --    -     --   --  /                                                 _________________________.-'                                 He asks you some questions. What are the correct answers, and what is the reward for getting them correct? Copy files from a list to a folder Consider the vectorspace of all real $m \times n$ vectors and define an    inner product $\langle A,B\rangle = \operatorname{tr}(B^T   A)$.    "tr" stands for "trace"        which is the sum of the diagonal entries of a matrix.   How do you prove that $\operatorname{tr}(B^T   A)$ is indeed a inner product?  Kind regards Compiler error C3493: 'func' cannot be implicitly captured because no default capture mode has been specified Down vote changed to up vote caused reputation meter to pass daily maximum I just experienced a minor visual bug.  I had an answer that earned 2 down votes and 22+ upvotes, earning me the daily maximum of +200. Upon making some edits to the answer at the behest of the comments, one of the users who down voted changed their vote. Now my reputation meter shows that I gained +202 for the day.    This correctly did NOT affect my reputation, as I still only gained 200, so it is merely a minor display bug.  This appears in the achievements drop down and my reputation tab on my profile. In what order should the Star Wars movies be watched? Please don't lynch me, but I've never sat through an entire Star Wars film. I'm aware that the 3 (new) films are technically prequels, but I feel strange watching 3 new films then 3 old films?  Do I need to watch the new ones then the old ones? There's vs There are Would you be weightless at the center of the Earth? If you could travel to the center of the Earth (or any planet), would you be weightless there? Proof that the relation $5 \mid (a + 4b)$ is symmetric and transitive How Do Dementors Communicate with Wizards? How to change password complexity requirements in Ubuntu 14.04LTS There's a way to safely try KDE on top of an Ubuntu installation, keeping the possibility to revert the changes in case I dislike how it runs? Multi armed bandit for general reward distribution I'm working on a multi-armed bandit problem where we do not have any information about the reward distribution.   I have found many papers which guarantee regret bounds for a distribution with known bound, and for general distributions with support in [0,1].   I would like to find out if there is a way to perform well in an environment where the reward distribution does not have any guarantees about its support.  I'm trying to compute a nonparametric tolerance limit and using that number to scale the reward distribution so I can use the algorithm 2 specified on this paper (). Does anyone think this approach will work?  If not, can anyone point me to the right spot?  Thanks a bunch! dpkg-divert: error: rename involves overwriting `/usr/lib/xorg/protocol.txt' with different file `/usr/lib/xorg/protocol-precise.txt', not allowed I just installed Ubuntu (12.04.4) and I upgraded to 13.10  I have no idea how to fix this :/  $ sudo apt-get install -f  Reading package lists... Done Building dependency tree        Reading state information... Done The following packages will be REMOVED:   xserver-common-lts-saucy 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded. 1 not fully installed or removed. After this operation, 1,718 kB disk space will be freed. Do you want to continue [Y/n]? y (Reading database ... 175174 files and directories currently installed.) Removing xserver-common-lts-saucy ... Removing 'diversion of /usr/lib/xorg/protocol.txt to /usr/lib/xorg/protocol-precise.txt by xserver-common-lts-saucy' dpkg-divert: error: rename involves overwriting `/usr/lib/xorg/protocol.txt' with   different file `/usr/lib/xorg/protocol-precise.txt', not allowed dpkg: error processing xserver-common-lts-saucy (--remove):  subprocess installed post-removal script returned error exit status 2 Errors were encountered while processing:  xserver-common-lts-saucy E: Sub-process /usr/bin/dpkg returned an error code (1)