I wrote program .. the user must enter a string with format (Barcode,price:number of item) and I calculate the total of barcode  my code is  import java.util.*;  public class hanoofee2 {     public static void main (String args[]) {         Scanner input=new Scanner (System.in);          System.out.println("Enter a string with format (Barcode,price:number of item) ");         String ent = input.nextLine();         String barcode = ent.substring(0,(ent.indexOf(",")));         String price = ent.substring((ent.indexOf(","))+1,(ent.indexOf(":")));         String number = ent.substring(ent.indexOf(":")+1,(ent.length()));          double price2 = Double.parseDouble(price);         int number2 = Integer.parseInt(number);         double total = price2 * number2;          String m = "";         if(barcode == "11A") {             m ="green pen";         } else if(barcode == "22B") {             m ="printer";         } else if(barcode == "44C") {             m ="Memory card";         } else if(barcode == "44D") {             m ="Cook book";         }          System.out.printf("The total price of%2s "+" is:%.2f ", m ,total);     } }   every things are ok but when I press run the value of " m" does not display       Enter a string with format (Barcode,price:number of item)         22B,222:30        The total price of    is:6660.00          ----jGRASP: operation complete.   what is the problem ?!
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
Am I technically allowed to look up cards during a Magic tournament match? Am I allowed to look up a card during a game, if it's being played with serious Rules Enforcement? Either to read the full card from the Gatherer, or to try to find the exact card I'm vaguely thinking of.  Two possible scenarios:   An opponent has revealed a card previously, and I want to remember the exact details. (Something like the exact wording of a sorcery, mana cost, keywords on a creature, subtypes, etc. etc.) I have a "name a card and remove it from the opponent's deck" type card, and I want to, say, ask google for "Blue Gearhulk" to remember that it's that that one is called "Torrential Gearhulk".   Obviously, in casual or semi-casual games neither of these are a problem. Any reasonable opponent will just re-reveal the known card (assuming it IS still guaranteed to be known) or will accept "I name the Blue Gearhulk".  Also obviously, it seems unlikely that I (or anyone else) would get to the stage of playing at the REL without knowing the cards too thoroughly for this to be relevant.  But in principle... is it permitted? Or not? (and if not, is there a good reason, or just "we decided 'No'"?) What is the importance of eigenvalues/eigenvectors? What is the importance of eigenvalues/eigenvectors? xml serializing of saved game data How do we prove $n^n \mid m^m \Rightarrow n \mid m$? I'm not sure I've got this right. When proving $a^n \mid b^n \Rightarrow a \mid b$, can we do this indirectly? In short,  "Suppose $a$ does not divide $b$, this implies that $a^n$ does not divide $b^n$. But $a^n \mid b^n$, hence $a$ divides $b$."  How about $n^n \mid m^m \Rightarrow n \mid m$? Can we do this the same way? Get three highest values from the array Booking travel tickets for visa without paying? Purchasing a Switch - AC vs DC Current Specifications? I'm trying to purchase several switches for a DC system with moderately low current (a few amps at 12V). When browsing for switches in parts catalogs (e.g.  and ) there are always separate voltage ratings for AC and DC applications. I understand that AC switches are less expensive because the switching time does not need to be as fast and arcing is less of a concern. There is only one current rating listed and I am not sure if it applies to AC switching, DC switching, or both.  Does this current rating apply to both the rated AC and DC voltages? Is there a good rule-of-thumb for converting between AC and DC voltage/current ratings? What is the highest current I could reasonably expect from a DC switch before moving to a relay? Merge array items into string Space before chapters and contents I am seeking advice on which memory to use with my motherboard and CPU. Below are my components and some relevant information extracted from their official websites.   NOTE: Although this is a very specific case, a general answer is equally good for me — and also alot more useful for everyone else!  CPU: AMD Phenom II X4 810   ASUS M4A785TD-V EVO listed as one of many  motherboards.   Motherboard: ASUS M4A785TD-V EVO   4 x DIMM, Max. 16 GB, DDR3 1800(O.C.)*/1600(O.C.)/1333/1066/800 ECC,Non-ECC,Un-buffered Memory Dual Channel memory architecture (Complete list of specs: ).   NOTE II: I wouldn't want to do any overclocking as I have no experience with that. So I think the 1333 MHz is the most appropriate. Since the higher frequencies are marked with "O.C."  Questions:   How can I be certain that a specific RAM will work well (or not work) together with my CPU and motherboard? (The Qualified Vendor List is a good starting point, but it's a bit limited and sometimes a bit outdated). Is it true that choice of memory is not independent of the processor? How?    I'm worried I'll be missing something essential when buying my next RAM chips :) I read with interest about Einstein's Theory of Relativity and his proposition about the speed of light being the universal speed limit.    So, if I were to travel in a spacecraft at (practically) the speed of light, would I freeze and stop moving?  Would the universe around me freeze and stop moving?  Who would the time stop for? Initialize parameter of method with default value I've seen some of the other threads on using strings as x axis labels, but nothing that fits my situation.  I'm trying to create a bar chart from a CSV file. I can do it so long as everything in the data is numeric. However, in my actual data table, the first row is multi-word string descriptions. I need these descriptions to be the x axis labels for each bar.  I've tried symbolic x coords, but I get the "could not parse input as a floating point number" error. I've also tried adding an ID column and using that as the x values, and assigning xtick labels as the string descriptors. I get the same issue that way.  Here's an attempt at an MWE:  \documentclass{article}  \usepackage{lmodern} \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable}  \begin{document}  \pgfplotstabletypeset[columns/category/.style={string type},col sep=comma]{Book3.csv} \vspace{1cm}  \begin{tikzpicture} \begin{axis}[ ybar, xlabel=Xstuff, ylabel=Value, symbolic x coords={cat a,cat b,cat c,cat d,cat e,cat f,cat g}, %xtick labels={cat a,cat b,cat c,cat d,cat e,cat f,cat g},% this is from when i tried the xtick label method xtick=data, nodes near coords, nodes near coords align={vertical}] \addplot table[x=category,y=value]{Book3.csv}; %\addplot table[x=category,y=value]{Book3.csv};&amp; again, from trying the xtick label method  \end{axis}  \end{tikzpicture} \end{document}   Since I suspect this might get answered quickly by you chart gurus, I have a follow-up question:  I have to do a bunch of these charts, and I would like to automate the symbolic x coords process. Is there a way to populate the dictionary of accepted x coords by reading a column of the data? (something like symbolic x coords={columns/category/{Book3.csv}} )?  Book3.csv looks like this (ignore the ID column if using the xtick label method):  ID, category, value, value 2 1,  cat a,    1,     7 2,  cat b,    2,     6 3,  cat c,    3,     5 4,  cat d,    4,     4 5,  cat e,    5,     3 6,  cat f,    6,     2 7,  cat g,    7,     1 How can I grep in PDF files? Is there a way to search PDF files using grep, without converting to text first in Ubuntu? How can I specify a custom date formate to be validated with the  for jQuery? How to remove a filter that is an anonymous object? Chapter 5: Are there multiple Endings? I just finished Episode 5 and wondered, if there were alternative endings or game branches. I brought the whole group with me, and am wondering what would have changed if different people accompined me, and if the episode is possible to play out differenly.      On my playthrough, Lee killed the stranger, and on the run back to Christa and Omid, was to weak to continue. Clementine shot him. Kenny died along with Ben after he fell off the building. And Lee was cut off Christa and Omid after they went over the "bridge" first. Why am I constantly running out of space on my Galaxy S2? What does the actual phrase above mean? The Raspberry Pi B+ models have a protection circuit between the USB connector and the 5V net on the board.  They recommend putting a similar protection circuity on a Pi HAT before 'backpowering' the pi through its GPIO header along with a polyfuse.  I understand why this is the recommendation, but I'd like to understand more about how this circuit works.  I did some searching before posting this question and found information on using a MOSFET as a low voltage drop diode, but they all had the gate wired directly to ground without the pair of PNP's and the resistors.  What are they doing for this circuit?  Also, is this primarily using the body diode?  In which case, what's the relevant info on the datasheet that qualifies DMG2305UX for this application?  In the other circuits I found, it appeared low Rdson and Vgsth compatible with the circuit seemed like the relevant characteristics.