We had a programming exam last week and I wasn't able to do it.   We were asked to make a program that will ask the user to select either of these three options:    given name middle name last name.    After selecting, you are asked to enter a name using scanner.   Then it will ask you if you want to try again, if you input yes, the program will loop again and if you enter the same name, it will prompt an error saying you already set it that way.  I've done all of it except that part, comparing the values.   How do I compare the 1st and 2nd input using scanner?  Here is what I have done so far.    public class PXM {     private String givenname;     private String middlename;     private String lastname;      public void setGN(String gn) {         this.givenname = gn;     }     public void setMN(String mn) {         this.middlename = mn;     }     public void setLN(String ln) {         this.lastname = ln;     }     public boolean equals() {     } }     import java.util.*;  public class TestPXM {     public static void main(String args[]) {         Scanner sc = new Scanner(System.in);         String yes;         int t;          PXM p1 = new PXM(); {             System.out.println("1. given name ");             System.out.println("2. middle name");             System.out.println("3. last name");              System.out.print("select method: ");             int method = sc.nextInt();             if (method == 1) {                 System.out.println("enter given name: ");                 String gn = sc.next();                 p1.setGN(gn);             }         }     } }
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?
I have, not one but two microSD cards that my phone (Samsung Galaxy Young, Gingerbread OS) seem to have broken. One is 1GB and the other is 2GB. The 1GB one won't be formatted.  When I put the 1GB one into the computer the computer prompts for a formatting. I don't care for the content so I tried to format it, but to no avail; the format fails and I have no idea what to do to make it work again.  I tried using the SDformatter software, but it can't format the card as it is write protected. I'm googling to solve it but so far no success.  My computer OS is win7 if that's of any relevance. Use Cauchy product to find a power series represenitation of   $$1 \over {(1-x)^3}$$ which is valid in the interval $(-1,1)$.   Is it right to use the product of $1 \over {1-x}$ and $1 \over {(1-x)^2}$ if I know thier expantion (HOW).. Is there another way? Find & Delete duplicated files on multiple harddisks at once I have 4 hard disks and want to find out which files on this four harddisks (including sub directories) are duplicates. It should be checked not only within a harddisk but against all the others as well.  The hard disks are large (3TB) therefor it has to be efficient (first filename than checksum checks or so) How do I remove code duplication between similar const and non-const member functions? If I'm given a complex number (say $9 + 4i$), how do I calculate its square root? I know Newton's third law of motion might be the answer for this but still I am wondering how the rockets could thrust in the empty space and move in the opposite direction. I guess an astronaut wouldn't be able to push in the empty space with his hands or legs to move himself, but with a rocket engine it's possible. How? What might be the explanation for this in General Relativity? How can I make a Random Number Generator with vanilla redstone? How do I protect random people pointing their domain to my server? Sometimes when reading through user comments on a particular answer, some usernames that appear like user[digit] e.g user12345 are not links. Is this a known behaviour or any other thing I am not aware of? Edits on closed posts Should questions or answers on questions that are closed be edited, even if the question is closed and the edit does not change anything about the reason it's closed? Example:  was just edited, which I saw in the review queue. It certainly improves the answer, but since the answer doesn't really have to exist on SE at all (because the question is off-topic), should this edit be made? In my understanding, the only reason that the edit option for a closed question is not greyed out is so that it can be edited to make it comply with the SE rules. Working on a future method to post values to external web service. But since there is a limit of 50 callouts per invocation, I am getting error "Too many future calls : 51". Cases are loaded into salesforce from external ETL in bulk. So is there a way to workaround this error.   Class  public with sharing class caseTrigger {      //method invoked by trigger after insert     public void CaseInsert(List&lt;Case&gt; caseIns){           list&lt;Id&gt; caseIds = new list&lt;id&gt;();             List&lt;Case&gt; caseList = [Select id from case WHERE Id IN :caseIds];                 for(Case c : caseList){                     if(c.Status != 'closed'){                         caseIds.add(c.id);                     }                          if(f.caseId_User.size()&gt;0){PostCases(caseIds);}      }     //postCases (future method)     @future(callout = true)     public static void PostCases(List&lt;Id&gt; Ids){         //prepare Json to post to webservice    } } Converting mxd to earlier version using ArcPy? Finding the limit of $x_1=0 , x_{n+1}=\frac{1}{1+x_n}$ Why are the two versions of Chromium and VLC available in Ubuntu software of different sizes? I need to prove that     $f_1 \in \Theta(g_1) \land f_2 \in \Theta(g_2) \implies f_1 + f_2 \in \Theta(\max\{g_1, g_2\})$    is relevant, but I have a slightly different case, so I don't know how to translate it into this one, because I need to turn the $f$'s into $g$'s.  Am I allowed to say $\max\{f_1, f_2\} \in \Theta(\max\{g_1, g_2\})$?  Or even $\Theta(\max\{f_1, f_2\}) = \Theta(\max\{g_1, g_2\})$? Prove $2^k+1$ divisible by 3 for odd K Recover harddrive data How to show that $|D_{2n}| = 2n$ via the presentation? Consider the dihedral group  $$D_{2n}= \langle a,b \mid a^n = 1 = b^2, b^{-1}ab = a^{-1}\rangle$$  How can I show that $|D_{2n}| = 2n$?   I'm trying to show that we can write every element in the form  $$x = a^i b^j$$ where $i= 0, 1, \dots, n-1$; $b = 0,1$.   I managed to show existence, and it is clear that there are $2n$ such elements, so if I can show that every choice of $i,j$ gives a distinct element, I'll be done.  Any ideas? How to disprove this fallacy that derivatives of $x^2$ and $x+x+x+\dots\quad(x\text{ times})$ are not same. Possible Duplicate:          \begin{align*} x^2 &amp;= \underbrace{x + x + x + \dots + x}_{x \text{ times}}, \\ \therefore \frac{\mathrm{d}}{\mathrm{d}x} (x^2) &amp;= \frac{\mathrm{d}}{\mathrm{d}x} (\underbrace{x + x + x + \dots + x}_{x \text{ times}}) \\ &amp;= \underbrace{1 + 1 + 1 + \dots + 1}_{x \text{ times}} \\ &amp;= x. \end{align*}  But we know that $$ \frac{\mathrm{d}}{\mathrm{d}x} (x^2) = 2x. $$  So what is the problem?  My take is that we cannot differentiate both sides because $\underbrace{{x+x+x+\cdots+x}}_{x \text{  times}}$ is not fixed and thus $1$ is not equal to $2$. Rename ToC, List of Figures, References I would like to know how to rename the standard list of figures, table of contents, and references. What I saw so far relying on \renewcommand{\contentsname}{name} did not work so far.  Here's the list of preambles I use:  \documentclass[12pt]{report} \usepackage[utf8]{inputenc}  \usepackage{fourier} \pagestyle{headings} \usepackage{marvosym} \usepackage[pdftex]{graphicx} \usepackage[margin=2.5cm]{geometry} \usepackage{rotating} \usepackage{amsmath} \usepackage{booktabs} \usepackage{url} \usepackage{natbib} \usepackage{setspace} \linespread{1.5} \newenvironment{remark}{\par\mbox{}\par\noindent{\bfseries             \emph{Remark}\/}:\normalfont}{\par} \newenvironment{defin}{\par\mbox{}\par\noindent\bfseries \emph{\Pointinghand\     }\normalfont}{\par} \setcounter{toc**strong text**depth}{2}  \usepackage[colorlinks=true, a4paper=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref} \pdfcompresslevel=9 \setstretch{1.0} %vertical stretch \usepackage{fontspec} \setmainfont[BoldFont       = AvenirNextRoundedPro-Bold.otf , ItalicFont     =AvenirNextRoundedPro-Italic.otf]{AvenirNextRoundedPro-Reg.otf} \defaultfontfeatures{Mapping=tex-text} \usepackage{multirow} \usepackage{array} \usepackage{booktabs} \usepackage{hyperref} \hypersetup{ hidelinks, } \usepackage{ragged2e} \usepackage{euler} \usepackage[euler-digits,euler-hat-accent]{eulervm} \usepackage[labelfont=bf]{caption} \usepackage{wrapfig} \usepackage{amsmath} \usepackage{amssymb}  \usepackage[english]{babel} \usepackage[nottoc]{tocbibind} %Adds "References" to toc \usepackage{titlesec} \titleformat{\chapter}[display]{\bfseries\huge}{\filleft\Large\chaptertitlename~\thechapter}{1ex}{\vspace{1ex}\filright}[\vspace{0.5ex}\titlerule] \usepackage{float} \usepackage{etoolbox} \makeatletter \patchcmd{\@caption}{\csname the#1\endcsname}{\csname fnum@#1\endcsname:}{}{} \renewcommand*\l@figure{\@dottedtocline{1}{2em}{6em}} \let\l@table\l@figure  \makeatother % default for 3rd arg: 2.3em - for list of figures and tables \usepackage{background} \definecolor{textcolor}{HTML}{000000}             \newcommand\Text{c\quad o\quad n\quad f\quad i\quad d\quad e\quad n\quad t\quad i\quad a\quad l} \SetBgColor{textcolor}\SetBgOpacity{0.3}\SetBgAngle{90}         \SetBgPosition{current page.center} \SetBgVshift{-0.33\textwidth} \SetBgScale{1.8}         \SetBgContents{\sffamily\Text} %for confidential   I also use TexMaker. I do not know how relevant it is, but here my document language is set to English (even if it's not the language I write in, in that document, but it isn't a problem seemingly). What I also saw is that, if I remove babel and the references, I can rename my ToC and LoF, LoT. But I need the references though. Any tip would be very welcome!  Edit: I cannot provide text data from my project, because it is confidential. Here's what I can provide from the main document. Here is what I can include more.  \begin{document} \include{02_front}  \setcounter{page}{0} \pagenumbering{roman} \tableofcontents \listoffigures \listoftables \newpage \setcounter{page}{0} \pagenumbering{arabic} \chapter{blabla} \section{test é è åøæ î} \appendix \bibliographystyle{plain}  \bibliography{80_refs}   \end{document}   Also, I actually finished writing my thesis but I need to summarize it briefly in another language, am would be extremely unwilling to test and remove packages that "might be" not very useful. I literally only have to change these names of ToC, LoF, ToF and references.