Please refer to the following code:          Scanner scan = new Scanner(System.in);     int T = Integer.parseInt(scan.nextLine());     StringBuilder []str = new StringBuilder[T];     String temp = new String();     for (int i=0; i &lt; T; i++){         temp = scan.nextLine();         str[i].append(temp);     }     System.out.println(str);   The above code throws a Null Pointer Exception on the line:  str[i].append(temp);   I want to do it with StringBuilder.
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 pivot rows into columns MySQL Been looking to pivot rows (progress_check) into columns check 1, check 2 etc... No sum or totals required, just to display the results hopefully... Can anyone help, Thanks Ad What does high credit utilization really mean? I'm having a difficulty in finding one way car rentals from Alaska, which I can return in Seattle.  Do all the main rental agencies restrict such one-way rentals, as they involve crossing through Canada, before entering the lower 48 states? I've completed my contracts. Now what? I completed the two contracts I was given (Scout and Heavy), and earned two of the 'Teufort' weapons for turning them in.  I expected to get some new contracts so I could continue to earn some more of the schmancy new weapons, but I can't seem to find out how to get more.  Do I need to buy the ticket again to unlock more contracts? If not, how are contracts assigned? I have a directory with numerous files. Part of the files have the 755 permissions and the other part have 644 permissions. I'd like to convert the files with 755 permissions to 644. I have tried the following line by running it from the directory itself:  find . -perm 755 -exec chmod 644 {}\;   However as a result, the permission changed only for the directory itself and after changing it back I found out that the files permissions remained unchanged. Do I miss something? I came across some scenarios like these:     Case 1: Obviously not true       Q: Why does the sun rise and fall every day?   A: Because the Earth .   A2: Because .     Case 2: Letting the OP do what is declared not to       Q: How can I charge my phone without a charger?   A: Try the USB ports on your computer.   A2: Go buy a charger.    Case 3: Attempt to joke (despite looking like a real answer)       Q: What's this round bird in bright red? [An image]   A: It may be a rare or mutated species of sparrow.   A2: It's a .   A3: It's an .    Should I flag A2/A3 as NAA in those cases? Comments/tips on a (non Latex) pdf including mathematical formulas My goal : I correct copies from students that I scan to pdf. I wish I could make the annotations on the scanned copies rather than on the physical paper. Today, I have to scan the copies again to have my annotations transferable to students by email. Since most of the annotations are similar, I wish to have a stock of annotations I could transfer on the copies.  I went through a lot of technologies, including many "StackExchange Questions" here. I considered pdfcomment, cooltips, fancytooltips, the OCG family (ocgx, ocgp, ocg2, ...), etc.  Two tracks attracted more specifically my attention :    pdfcomments : I like the mouseover to see the comment, the capabillity to move the annotation around so I can have a stock on a pdf and I can copy it onto the scanned copies. This would be my choice if there was not a main drawback : it accepts only plain text when I need to use mathematical notations. (It needs selected pdf readers). Because you can move comments, you can put them on any pdf, even if it is not compiled from Latex or if you don't have the source. fancytooltips : I like the mouseover to see the comment, and the capability to use LaTeX mathematical formulas and images. Drawbacks : I can't move the annotation from a pdf document to the copies. (It works with very few pdf readers.) . I am not sure whether I can put tips on non Latex pdfs.   Is there a way to have pdfcomment have images/Latex mathematical formulas (or references to formulas that can show with a mouseover) ? Or is there a way to transfer fancytooltips to a non Latex pdf ? Or are there other techniques to achieve the goal ? Is there a way to connect my MacBook Pro to two external monitors (either VGA or HDMI; no Thunderbolt) in such a way that the Mac screen serves as a third monitor?  What hardware do I need? How to make child collide When a spaceship is experiencing a constant acceleration of $10m/s^2$, the astronauts will be moving at nearly the speed of light after about a year in the earth's reference frame. This means the spaceship's energy will start to diverge as a function of the speed $v$ so there will be a huge amount of energy necessary to increase the speed of the ship any further. This way, the speed of light can never be crossed.  All of this is clear to me, but all of this is also formulated in earth's reference frame. But from the astronaut's reference frame: the spaceship is simply accelerating at $10m/s^2$ and so the force on the spaceship is constant. Then why would we need huge amounts of energy to accelerate the spaceship?  For example, I read somewhere that the amount of energy that would be needed to accelerate a large spaceship to half the speed of light is more than 2000 times the current world annual energy consumption. How does this make sense in the astronaut's (non-inertial) frame? Which creatures in Tolkien's literature can be female? How to get sudo to prompt you for a password each time I'm new to ArcGIS 10 and am trying to do a really simple field calculator equation and it is not working. I'm just trying to find the percentage of a certain demographic trait by doing:  [asian]/[total]*100   It is populating about 10% of the column correctly and then I get an error:     There was a failure during processing, check the Geoprocessing Results   window for details   Obviously my syntax is not incorrect or else it wouldn't start populating the field correctly.   Does anyone have any idea why this is happening? Is there a place on the internet where I could find actual Star Trek episode scripts? Through the years I have purchased a few Star Trek scripts. I even have a DS9 script a buddy of mine mistakenly took off set and dazzled me with at Christmas years ago. As neat as those are to own, they are impossible to search. Is there a place on the internet where the Star Trek show or movie scripts can be obtained in digital format?  (Sometimes I remember a quote and would love to find it. From time to time the internet delivers. Occasionally it does not. I want to have a resource to find quotes as I think of them.) strange character replacement on SO I added a comment to  but something strange is happening. The end code reads "); but SO decided to change that to ";);.    I did not add a ; in front of the ).  To further explain what's happening here, the following:  "http://example.com/." http://example.com/. "http://example.com." http://example.com. "http://example.com" http://example.com   renders as: How does matchmaking work in Play mode? How does Hearthstone match you with opponents in Play mode, for both Ranked and Unranked? Does your record in Ranked affect matchmaking in Unranked (and vice-versa)? I was using my MacBook Pro (with 16GB of RAM) as usual and out of blue I've this popup that:  Your system has run out of application memory. To avoid problems with your computer, quit any applications you are not using.   I've obviously closed few which I could, but it didn't help. After checking on memory, it seems kernel task ate 7GB and 22.36GB swap memory was used of total 23GB (which obviously was the case). However I've still 20GB of space free on my SDD.  Activity Monitor didn't help much whilst my OS X was heading to the destruction.    My top stats before my kernel freeze: Processes: 344 total, 2 running, 5 stuck, 337 sleeping, 2580 threads                                                                                                                         19:23:56 Load Avg: 1.56, 1.62, 2.09  CPU usage: 3.51% user, 8.47% sys, 88.1% idle   SharedLibs: 46M resident, 0B data, 6572K linkedit. MemRegions: 757970 total, 2139M resident, 56M private, 907M shared. PhysMem: 9410M used (6198M wired), 556M unused. VM: 1155G vsize, 1311M framework vsize, 112872658(320) swapins, 122668389(0) swapouts. Networks: packets: 299419263/363G in, 142126838/14G out. Disks: 58970173/1079G read, 20012389/1120G written.  At the end my OS X frozen and I had to do hard reset, repair my SDD in recovery mode and fixing afterwards (recovering lost work, fixing application conflicts, checking my lost+found folder, Chrome/Terminal tabs gone, headache, etc.). My question is, how do I check on high memory usage of kernel task or how to properly deal with that kind of situation? I've tried to take Sample with Activity Monitor, but it's greyed out.  My MacBook Pro details: 2.3GHz Intel Core i7 (late 2013) with 16GB RAM. OS X: 10.9.5 UK Visitor Visa: Required Time or Interval Between Visits? I am a US citizen and have recently visted the UK  with simply a passport which allowed me to vist for 6months I have heard rumors that I am obligated to stay in the US for a Equal amount of time that I have visited the UK before I am able to return, but I am struggling tour no any proof of this obligation .. Am I missing somthing or is it simply not true Let $f:\mathbb{R}\to \mathbb{R}$ be a continuous map such that $\overline{f(\mathbb{N})} = \mathbb{R}$. Prove that $f$ is surjective.  I tried to use the definition of the continuity and $\overline{f(\mathbb{N})} = \mathbb{R}$ to show that $f$ is surjective but it didn't work. Since $f$ is continuous, the preimage of every open set is open. Also it results in $f(\overline{A})\subseteq \overline{f(A)}$ for every set $A$. How this couples with $\overline{f(\mathbb{N})} = \mathbb{R}$ to show surjectivity? Plot points:   I think the man was one-armed or had one damaged/withered arm. He is an artist when we meet him. He's picked up by aliens to represent earth in a galactic armada. Put in a ship with other aliens only there so a representative of their species can be said to be present - but not expected to actually contribute much to the coming fight. Fight is to protect against invaders from another galaxy. Somehow or other, their ship and crew become integral to winning the war.