In my addStudent method I am trying to add students(objects) in an object array, but I receive nullPointerException when I add even one object there.  package task2;  public class StudentGroup {     String groupSubject;     Student[] students;     int freePlaces;      StudentGroup(){         Student[] students = new Student[5];         freePlaces = 5;     }     StudentGroup(String subject){         this();         this.groupSubject = subject;     }      void addStudent(Student s){         if(freePlaces &gt; 0 &amp;&amp; s.subject.equals(this.groupSubject)) {                     this.students[this.freePlaces-1] = s;                                      //check mistake?             freePlaces--;         }         else{             System.out.println("Student isn't from same subject or there aren't any free spaces!");         }     }      void emptyGroup(){         Student[] students = new Student[5];         freePlaces = 5;     }      String bestStudent(){         double highestGrade = students[0].grade;         String name = students[0].name;         for (int i = 1; i &lt; students.length; i++) {             if(students[i].grade &gt; highestGrade){                 highestGrade = students[i].grade;                 name = students[i].name;             }         }         return name;     }      void printStudentsInGroup(){         for (int i = 0; i &lt; students.length; i++) {             System.out.println(students[i].name + "-" + students[i].grade);         }     } }   I am also not sure if I can just call 5 times the method and fill every student in the array or I have to loop over the array to do so. Most of the info on Internet is with ArrayList, but I can't use 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?
I'm searching a way to append a group in Python.  It should behave exactly like the Append function (ShiftF1) works, all objects should be local and editable. The idea is to append a character (with rig etc.) via Python and not Link it (to be able to modify it without making everything local one by one).  Thanks I have an application running on node and using the mongodb library to establish connection and closing it. But the problem is, from the mongo serverStatus() command i can see that there is still 2k+ current connections still available.  &gt; db.serverStatus().connections { "current" : 2993, "available" : 835867, "totalCreated" : 220841 }   and most of it are having the active: false status.  My questions is, is there a way for me to force close these idle connections which after some time will affect my application with an timeout error.  I tried using the killOp() command but these only works if there is still opid value listed in these idle connections.  Appreciate some feedback on how can handle this kind of situations. Does Overhand Chop override the damage bonus from wielding a two handed weapon? I was showing a GM friend of mine a build I was making that uses the Two-Handed Fighter Archetype and we are both unsure of how it interacts with the damage bonus you get from two-handed weapons (which is 1-1/2 times your STR.) It reads:     Overhand Chop (Ex): At 3rd level, when a two-handed fighter makes a single attack (with the attack action or a charge) with a two-handed weapon, he adds double his Strength bonus on damage rolls. This ability replaces armor training 1.   So, does Overhand Chop turn the 1-1/2 times multiplier from two-handed weapons into a 2 times multiplier, or do the two add up? Or, do they interact in some other way?   This assumes a Medium sized character with 20 STR and a greatsword with 3 levels. Is energy content of a system different depending on the observer? For the sake of simplicity, let's imagine that the entire universe is empty except for a single lump of (classical) matter with mass $m$. In its center of momentum frame, it is clear that the total energy is simply $E_\text{CoM}=mc^2$. However, in a frame moving relative to it with speed $v$, we have $E_\text{moving}=\sqrt{m^2c^4+p^2c^2}&gt; mc^2$ for all nonzero $v$.  Are we to infer that the energy content of a system can be different relative to the observer? Does this not violate the first law of thermodynamics? What exactly is the difference between a parametric and non-parametric model? I am confused with the definition of non-parametric model after reading this link  and .   Originally I thought "parametric vs non-parametric" means if we have distribution assumptions on the model (similar to parametric or non-parametric hypothesis testing). But both of the resources claim "parametric vs non-parametric" can be determined by if number of parameters in the model is depending on number of rows in the data matrix.  For kernel density estimation (non-parametric) such a definition can be applied. But under this definition how can a neural network be a non-parametric model, as the number of parameters in the model is depending on the neural network structure and not on the number of rows in the data matrix?  What exactly is the difference between parametric and a non-parametric model? What are the proposed theoretical explanations for the EmDrive? Not sure if someone else has already raised this - I've got eleven notifications that I've received a Caucus badge on English Language Learners. Perhaps one notification for each community that I'm a member of?  I am a member of the community, and did visit the election. Also, the badge hasn't been awarded more that once (so I think it's just the notification that's at fault).  Note that this seems to happen for other badges, it has been reported for: Caucus, Nice Answer, Enthusiast. How do I repeat a theorem number? Often in my papers I want to mention theorems in the introduction that are introduced in more detail and proved in a later section.  I'd like to include the statement of these theorems twice over, each time numbered as the theorem would naturally appear in its later section.  My current solution (using amsthm) is, e.g.  %(in the introduction) \newtheorem*{thm:associativity}{Theorem \ref{thm:associativity}} \begin{thm:associativity} Lorem ipsum ... \end{thm:associativity}  %(in a later section) \begin{thm} \label{thm:associativity} Lorem ipsum ... \end{thm}      Can anyone think of a cleaner solution? Converting truth tables to boolean expressions Install java Runtime Environment Marketing Cloud contact builder shows 9 times more contacts Custom fields not useable in Approve/Reject Approval Request I'm trying to get through my first SalesForce mod and it's definitely been a rocky path. I have one task I'm trying to do, but this section is holding me back.  I have two custom fields.  One a pick list and the other a text box. I have added them to the Approve/Reject Approval Request section in the Opportunity page. I added the fields through the Select Fields to Display on Approval Page Layout and they DO show up on the Approve/Reject Approval Request section. I added them in like ().  However, just the label for the fields show, the field itself is nowhere to be found and can't be used.    You can see and even use the fields when you open the Opportunity page itself, but when you go to use the Approve/Reject, you can't do anything with them or see any values.  I was never a SalesForce user and got this tossed in my lap and really don't know my way around yet. I appreciate any help on this!!  Thanks!!  Kurt Assuming i have a line that i want to add to a file without opening an editor.  How could i append this line  alias list='ls -cl --group-directories-first'   to this file  config.fish Help with this trigonometry problem Prevent Use of the Back Button (in IE) Compute the limit of $\sqrt{1-a}\sum\limits_{n=0}^{+\infty} a^{n^2}$ when $a\to1^-$ I need some suggestions, hints for the limit when $a \to 1^{-}$ of $$\sqrt{\,1 - a\,}\,\sum_{n = 0}^{\infty}a^{n^{2}}.$$ How to get UTF-8 working in Java webapps? How do I add a custom script on a specific page? I wanted to add custom JavaScript code on certain nodes. I have written this code in the html.tpl.php template, but this doesn't work. (donate is the path alias for a node.) &lt;?php if(arg(0) == 'DONATE'): ?&gt;   &lt;script&gt;     (function() {       // ...     );   &lt;/script&gt; &lt;?php endif; ?&gt; Generate random numbers uniformly over an entire range Sieve of eratosthenes infinite primes I don't understand why the sieve of eratosthenes doesn't prove an infinite number of primes.  For example the number 2 eliminates 1/2 of an infinite number of numbers.  The next prime, 3, eliminates 1/3 of the remainder, not 1/3 of all the numbers and so on.  5 would eliminate 1/5 of the remaining numbers. Why doesn't that prove an infinite number of primes? Thanks