I am getting a null pointer exception on my nameA = view.getHumanName(nameB); line in my model class. I am trying to establish nameA using the getHumanName method from the view class. I also attempted to add in this.view = view to the model constructor but that does not fix the issue. Why am I getting this error in this instance?  Model class and instance variable:     public Model(Dice die){       nameB = "Toby";       nameA = view.getHumanName(nameB);       p1 = new Player(nameA);       p2 = new Player(nameB);       this.die = die;    } }   Method in View class:  public String getHumanName(String compName){    System.out.println("Enter a name for the human player: ");    String humanName = scan.nextLine();    while(humanName.equals(compName) || humanName.trim().isEmpty()){         System.out.println("The human player cannot have the same name as the computer player or be blank. Enter a new name for the human player: ");         humanName = scan.nextLine();    }    return humanName; }
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?
Consider a string under tension, for example, a string on a guitar. When a guitar string is plucked, it vibrates at a certain frequency. When the tension on the string is increased by twisting the tuning peg at the end of the neck, the frequency of the string increases. According to , increasing the tension on a string also increases the speed of the wave moving through it. According to  the speed of a wave is higher in a more dense medium.  Does this mean that increasing the tension also increases the density?  This does not seem very logical to me, since density is the "compactness" of a substance, or how close together the individual molecules are. By twisting the tuning peg on a guitar, you rotate the cylinder that the string is fixed to, wrapping it around more tightly. This pulls more of the string around that cylinder, similarly to when you reel in a fishing rod. Since more of the string's molecules are now wrapped around the peg, there should be fewer molecules over the same distance between the bridge and the nut (the two ends of the vibrating portion of the string), therefore bringing the density down. How many maximum CPUs does Ubuntu support by default? I think this is kernel dependent and probably will change over time depending on the kernel a release uses, correct me if wrong  I'd like to know two things for all the currently supported Ubuntu releases:  How many maximum CPUs can Ubuntu handle (by default) at the same time with a standard desktop kernel? Is that count different from a server kernel and 32bit/64bit systems?  Where can I find that information on my system? Why does Windows 7 ask for additional drivers when installing from a USB 3.0 drive? Switch from single to double column in the same page At what speed does our universe expand? What is the difference between the | and || or operators? I have always used || (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: |. What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable? How to create an OD road distance matrix in QGIS? I'm looking for the steps required to produce an origin-destination (OD) cost matrix.  What I'm looking for is a matrix of road distances. The distance matrix tool only produces euclidian distances. The QGIS Roadgraph plugin produces the shortest road distance from one origin to N destinations. What I need is a file containing distances from all origins to the N closest destinations. I have a lot of origins so repeating the analyses with Roadgraph is not an option. Thanks again.  I'm looking for a step-by-step description, starting from scratch (ie, with my 3 shapefiles: origins, destinations, road network). Wake screen after scheduled task wakes computer I use Chrome across 4 different workstations and I have my extensions synced across all of them.  The problem I have is that one of the extensions () works great if you've got an actual mouse, but on a trackpad on Ubuntu, it just gets in the way.  If I disable it on the Ubuntu machine, it gets disabled on all Chrome installations due to its .  Q: Can I selectively disable an extension on just a single machine? Error message in my excel formula Today I saw a sentence:  She surely can do it.  What does that mean? How does it differ from:  She certainly can do it. Surely she can do it.  This slight difference in meaning of those sentences I am not able to notice. Could you please help me? Thanks in advance! Prove that $\lim \limits_{n \to \infty} \frac{x^n}{n!} = 0$, $x \in \Bbb R$. Why is     $$\lim_{n \to \infty} \frac{2^n}{n!}=0\text{ ?}$$   Can we generalize it to any exponent $x \in \Bbb R$? This is to say, is     $$\lim_{n \to \infty} \frac{x^n}{n!}=0\text{ ?}$$     This is being repurposed in an effort to cut down on duplicates, see here: Coping with  duplicate questions.  and here: . Move the Add Favorite / Ignored Tags boxes to the top It seems that most people who use the ignored tags feature end up with a fairly long list of those tags.  Although , it is sometimes necessary to add new ignored tags manually (typically when adding some-tag*).  It would be a lot easier if the add box was above the long list of ignored tags rather than below. I suppose the same would apply to the favorites tags for consistency's sake. Travel to Australia with new passport (with visa in old passport) I was granted a visa to Australia few months ago. I’d like to travel to Australia in few days. However, I’ve just renewed my passport and I don’t have enough time to inform them about my passport renewal. Can I travel to Australia by carrying both my old and my new passports? How do I iterate over cin line by line in C++? BeanFactory vs ApplicationContext I'm pretty new to the Spring Framework, I've been playing around with it and putting a few samples apps together for the purposes of evaluating Spring MVC for use in an upcoming company project. So far I really like what I see in Spring MVC, seems very easy to use and encourages you to write classes that are very unit test-friendly.  Just as an exercise, I'm writing a main method for one of my sample/test projects. One thing I'm unclear about is the exact differences between BeanFactory and ApplicationContext - which is appropriate to use in which conditions?  I understand that ApplicationContext extends BeanFactory, but if I'm just writing a simple main method, do I need the extra functionality that ApplicationContext provides? And just exactly what kind of extra functionality does ApplicationContext provide?  In addition to answering "which should I use in a main() method", are there any standards or guidelines as far as which implementation I should use in such a scenario? Should my main() method be written to depend on the bean/application configuration to be in XML format - is that a safe assumption, or am I locking the user into something specific?  And does this answer change in a web environment - if any of my classes needed to be aware of Spring, are they more likely to need ApplicationContext?  Thanks for any help. I know a lot of these questions are probably answered in the reference manual, but I'm having a hard time finding a clear breakdown of these two interfaces and the pros/cons of each without reading thru the manual with a fine-tooth comb. Differences between "however", "although","albeit", etc Suppose that I would like to record some video sessions of Angry Birds on my phone.   Are there any apps that I can use? I have root permissions. Are you allowed to use numbers as table names in MySQL? I'm thinking of having a program that dynamically creates new tables as the need arises. Can I have tables named with just numbers in MySQL? Deleting comment removes "Add comment" link on Mobile If I delete a comment on the mobile version of the site (at least if it's the only comment on an answer), the "Add comment" link will vanish along with the comment, so I have to reload to leave another comment.     but got declined as , which is why I'm reposting this (as it may well be a new bug with the same symptoms).  I'm using Firefox 32.0.3 on Android.