so I've been scratching over why my code doesn't work. I have 2 classes, the first one is where I have my getters and setters:  public class ShopItems {   private String itemName;   private double price;    public double getPrice(){     return price;   }    public String getItemName(){     return itemName;   }    private void setPrice(p){     price = Math.abs(p);   }    public ShopItems(String i, double p){     itemName = i.toUpperCase();     setPrice(p);   } }   and here is my second class, where I make an ArrayList:  public class ShopLedger {   private ArrayList&lt;ShopItems&gt; shoppingList;    //I want to make a deep copy of the items in the parameter into shopping list.   public ShopLedger(ArrayList&lt;ShopItems&gt; s){     shoppingList = new ArrayList&lt;ShopItems&gt; (s);      for(int i=0;i&lt;s.size();i++){       shoppingList.set(i,s.get(i));     }   }    //And here is where things go wrong. I want the method to return the price of the item   //in the parameter, and return null if the item name cannot be found.   public Double getPrice(String itemName) {   for(int i=0;i&lt;shoppingList.size();i++){     if(shoppingList.get(i).getItemName() == itemName){       return shoppingList.get(i).getPrice();     }   }   return null;  } }   This is what I have now, and the code keeps giving me the error "java.lang.NullPointerException". My client class sets the shoppingList as:     Candy(2.3), Book(20.0), Pens(5.5), Tape(10.2) and itemName is Pens.  However, I've gone into debug mode and for some reason, this part of the getPrice method:  if(shoppingList.get(i).getItemName() == itemName){       return shoppingList.get(i).getPrice(); }   never executes. Please help!
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?
Blocking web sites with Windows Firewall Is it possible to use Windows Firewall to block specific web sites for all browsers? How to view monitor refresh rate in macOS? I just purchased a Dell P2175Q monitor for my 15" MBP w/Touchbar. I'm connecting with a USB-C to DisplayPort cable, but when I go to Apple > System Preference > Displays, there is nothing about the Refresh Rate. Pressing the Option key does not show any additional options.  I've seen countless screenshots where this information should appear. Is there another way to check the refresh rate?  I'm on macOS 10.13.4  Thanks. Seeking options for Spatial ETL (Extract, Transform, Load)? I am interested in the pros and cons of various spatial ETL (extract, transform, load) tools.  If you have used the items listed here (or add your own), I seek your opinions and experiences.  In particular I would like to see usability comparisons of:    (proprietary)  (proprietary, subset of FME features)  (open source)  (open source)  (I don't know that it is truly ETL, but more of a file translation toolset) Any additional lot listed   There is no need to give a review of ALL software mentioned.  If you are experienced with even one then that will be very beneficial in making a decision about which direction to go.  Example: I am looking to create a schema conversion function that will allow me to select the input layer, create a translation, and output to a new, pre-defined schema.  Optimally, after creating the translation script, I would like to have an interactive form where I can "map" fields in my input layer to the output layer (ie- The output layer will have a field called "Address", what is it called in the input layer?)  Some were mentioned in the Q&amp;A at   And here are a couple of related articles that I found. Why hash the message before signing it with RSA? How do I build a TRRS headphone jack with a jack that is detectable by an iPhone I have a circuit and I am trying to integrate it with an iPhone via a TRRS headphone jack's microphone input. I have a generic TRRS cord and am trying to send a signal through it. However, the iPhone does not detect that a mic is even plugged in. However, if I plug it into my Mac via line-in and record, I can record the signal I am sending perfectly.   I have read online that it needs to detect resistance between the ground and mic, which I have. Are there any other things I need to do? It seems like this is an issue that stems from Apple's proprietary technology, as the earbuds are from a Windows Phone before they were spliced.    Thanks so much! Steward badge can now be awarded multiple times -- backfill details As we announced in our post on  to the Review Queues, the Steward badge can now be earned more than once per queue. The purpose of this post is not to debate the merits of this decision ( already exists), but to explain the nuts and bolts of how it will be backfilled. This is how it will appear on your profile if you have earned it multiple times:  Once we push the visual design changes live across the network, this is how badge attainment will look on /review/close/stats:  For those of you who have already completed enough reviews to earn multiple Steward badges, we will be retroactively awarding them to you, starting today. The backfill script will run about twice an hour, and your achievements trophy will light up as each one is awarded. For those of you who have done thousands and thousands of reviews, things may be a bit noisy, so we thank you in advance for your patience. It may take up to two days for all of your badges to show up. Where is a good place to learn classical optics for high school competitions? Is ∅ equivalent to {∅}? I find that often after awakening from suspend on Ubuntu GNOME 16.04 with GNOME 3.20 (I have only found this issue on the latest version, though I have not tried with GNOME 3.18 on 16.04) that I get this strange font issue which can't be fixed by restarting gnome-shell and seemingly only by restarting my entire machine:            I do not believe that this is a theme issue as I have tried all the built-in themes (including the dark and light versions) and it is the same for them all. Though it does not seem to affect gnome-shell areas, that is the top-bar, the Activities Overview, etc, are not affected for some reason. So what could this issue be caused by and how can I fix or workaround it?  Information Update:  I have had a look at  but the only options in the gnome-tweak-tool for Antialiasing are Rgba, None, and Grayscale, but none of them seem to have any affect on the issue. Is there something I'm missing? I would like footnote numbering to continue over pages and chapters. In my document it's reset every chapter. I'm using the report documentclass. Prove that $\frac{ 5^{125}-1}{ 5^{25}-1}$ is a composite number Do I need to pay in full for hostel reservation to show proof of accommodation for a Schengen visa? I am applying for a Schengen visa to travel to Germany and one of the requirements is showing proof of accommodation. I booked all my hostels via hostelworld.com, but only paid the non-refundable deposit (a couple of dollars for each place) instead of the entire amount. I intend to pay the rest of it on arrival at the hostel (or cancel it and go CouchSurfing, thus saving money).  But for the visa application, will the non-refundable deposit be enough to show proof of accommodation?  The reason I ask is, I emailed one of the hostels requesting a document showing my name and accommodation confirmation, and they replied saying they could only give me such a document once I pay in FULL.  Is this how I'm supposed to book for all places?  Have I been doing it wrong all this while (by only paying the tiny non-refundable deposit instead of full hostel fare)? Can't execute terminal commands: "the command 'sudo' is available in '/usr/bin/sudo'" Can we implement a dead time on answers for high reputation user Summary: High reputation users on SO come swooping in the second a simple question is posted, and get the first answer in before I've even opened my Python interpreter to test my idea out.  This actually is a problem because it prevents use lower users who aren't as good  at programming from getting any answers in.  This makes it very hard to build up reputation.  Thus, I propose a short dead time for high reputation users where their answers do not appear.  The Problem: This isn't just reputation.  By answering questions and having discussions with OP, we all get better at our language.  Teaching is one of the best ways of learning, and a more well versed population is absolutely good for SO.  (If anyone wants to argue that, go home)  While its nice to have folks who can quickly answer nearly all questions in a jiffy, its a little frustrating for those of use who simply aren't as fast, but still want to contribute.  The result is that many people do not answer questions because they feel like they just can't get an edge in.  SO should aim to incentivize as many answers by as many users as possible.  The most answers from the most users is the most beneficial situation for the site and the community. Once we accept this idea, it is clear that something needs to be done to address the issue at hand    The Solution: Luckily, this is an easy problem to solve; we use a dead time.  High reputation users can post answers whenever they like, but they won't appear until after the dead time is completed.  The trick is balance, a dead time which is too long will harm the OP as the question will remain unanswered, however, a dead time which is too short won't actually fix the problem.  There definitely needs to be a discussion about what "high reputation" means and what dead time to use, but it should be independent of whether y'all agree that this is a problem.  So, what do you think?  EDIT: Wow, -18, I leave for lunch for 30 minutes and this is what happens!  I guess y'all think this is a bad idea, but let me try to clarify a few things on which I was unclear earlier.  This is not about reputation.  This is not about getting the first answer just for the sake of getting to say "in before..."  This is about learning.  By getting a shot at answering questions before the high reputation users, people learn. Think of it as doing an example problem in class before the teacher does it. You get a chance to try it yourself, test your knowledge, and if you fail, then the teacher is right behind you to show the correct solution.  This is what I'm trying to accomplish. However, seeing the solution, and then trying to answer the question, is not very helpful. This is how I view the status quo.    In response to Mr. Pieters' answer and comments: You're absolutely right, this is not about quantity, its about quality.  The fastest answer isn't always the best.  But asking the high reputation users to take a step back for a few minutes is a means of getting there.    Hopefully this clears things up a bit. Possibly offensive usernames I flagged  as having a  ():    I said "possibly offensive" because it's possible it's a genuine surname I wasn't aware of, but googleing didn't show any evidence and  pretty much matched my definition of it which seems offensive.   Is this really a genuine name? If not how is it possibly not offensive and thus a bad flag?   (I flagged in good faith so even if it is a genuine name declining seems harsh) How does the EMH hold onto a phaser while having bullets go through him? In the Voyager episode: "Future's End, Part II" the doctor rescues B'elanna and Chakotay.     PORTER: They've got lasers! A black man and some bald guy.  (The EMH   enters. Porter and Butch's bullets go straight through him.)       PORTER: God in heaven help us.       EMH: Divine intervention is unlikely.  (The EMH phaser stuns them,   then unties Torres and Chakotay.)   In an earlier episode of Voyager, "Phage":     PARIS: But a hologram is just a projection of light held in a magnetic   containment field. There's no real matter involved. (The EMH slaps   Paris.)       EMH: Now, you hit me.  (Paris's hand passes through the EMH's head.)       EMH: The magnetic containment field that creates the illusion of my   body can be modulated to allow matter to pass through it or be   stopped. I might be able to modulate the holographic lungs in the same   way, allowing oxygen and carbon dioxide to pass from the lungs to the   blood stream.   In order to make the above adjustments the doctor had to touch several buttons on a control panel. I realize the time I refer to above he was using the holo-emitter instead.    How does it work exactly that the doctor can have bullets pass straight through him but he's able to hold on to a phaser without it falling out of his hand? Can he simultaneously have part of his body be transparent and the rest be more like matter at the same time? What if the bullets hit the hand holding the phaser? I think one had a shotgun as I recall so there probably would have been pellets going all over the place. I am looking for the definition of when I am allowed to do forward declaration of a class in another class's header file:  Am I allowed to do it for a base class, for a class held as a member, for a class passed to member function by reference, etc. ? In C++, sizeof('a') == sizeof(char) == 1. This makes intuitive sense, since 'a' is a character literal, and sizeof(char) == 1 as defined by the standard.  In C however, sizeof('a') == sizeof(int). That is, it appears that C character literals are actually integers. Does anyone know why? I can find plenty of mentions of this C quirk but no explanation for why it exists. Launchers for installed snap applications (including Ubuntu Software) disappeared after installing GNOME Software Cannot find Underground Jungle Temple On my 1.2 Terraria Map I have been mining from left to right in my large underground jungle using my rocket launcher. Despite this, I have had no luck on finding the Underground Jungle Lihzahrd Temple. I have been searching the layer above where lava constantly spawns. Have I simply spawned in a world without one or am I searching in the wrong place? I have also considered using the clentimator with Dark Blue ammo to provide light, should I do that?