I created two separate classes, main and leads. The following is from 'leads' , I am trying to apply Leads.primeLead(); if the user answers Yes on the first question, and if not, I'd like to write a different method to add all the necessary information. My problem is that, I don't quite understand why the primeLead() wont apply on Lead constructor or how am I supposed to define it so it will. import java.util.ArrayList; import java.util.Scanner;  public class Lead {      String nameLead;     int ageLead;     int phoneLead;     String cityLead;     String email;     String otherNotes;      int indexOfLead = 0;     int i = indexOfLead;      ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;();     ArrayList&lt;Integer&gt; ages = new ArrayList&lt;Integer&gt;();     ArrayList&lt;Integer&gt; phones = new ArrayList&lt;Integer&gt;();     ArrayList&lt;String&gt; cities = new ArrayList&lt;String&gt;();     ArrayList&lt;String&gt; emails = new ArrayList&lt;String&gt;();     ArrayList&lt;String&gt; notes = new ArrayList&lt;String&gt;();      Scanner leads = new Scanner(System.in);      Lead() {         System.out.println(&quot;Is this the first lead? (Y/N) &quot;);         if (leads.nextLine() == &quot;Y&quot;) {             this.primeLead();         }     }     /* public mainMenuLead(){         System.out.println(&quot;Please choose one of the following options&quot;);     } */       Lead newLeads = new Lead();      public void primeLead() {         i = 0;         System.out.println(&quot;============================================&quot;);         System.out.println(&quot;  Please enter by the following order : &quot;);         System.out.println(&quot;     Name, age, phone , city, mail     &quot;);         System.out.println(&quot;============================================&quot;);          System.out.println(&quot;Please enter the name of the Lead :  &quot;);         names.add(leads.nextLine());          System.out.println(&quot;Age? :  &quot;);         ages.add(Integer.parseInt(leads.nextLine()));          System.out.println(&quot;Phone number? &quot;);         phones.add(Integer.parseInt(leads.nextLine()));          System.out.println(&quot;Would you like to add ... &quot;);         System.out.println(&quot;1) City? &quot;);         System.out.println(&quot;2) Email? &quot;);         System.out.println(&quot;3) Notes?  &quot;);          if (leads.nextLine() == &quot;1&quot;) {             System.out.println(&quot;Please add City: &quot;);             cities.add(leads.nextLine());          } else if (leads.nextLine() == &quot;2&quot;) {             System.out.println(&quot;Please add email : &quot;);             emails.add(leads.nextLine());          } else if (leads.nextLine() == &quot;3&quot;) {             System.out.println(&quot;Please add any other notes you may have:  &quot;);             notes.add(leads.nextLine());         }     } }
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?
"This webpage has a redirect loop" in Chrome but working fine on FF and IE? xargs and vi - "Input is not from a terminal" Searching by user id in Android app only shows questions, no answers I have a Samsung Galaxy S3. Android version 4.3  I downloaded the official StackExchange app today. I am not able to view post related to android tag from my profile. I tried refreshing also  Snap     Edit:  However i am able to see one post for the relevant from the drop down list    Edit 2:  I tried what Steven V suggested. However it's the same.    I tried for a different user its the same. Modus Operandi. Formulae for Maximum and Minimum of two numbers with a + b and $|a - b|$ I came across the following problem in my self-study of real analysis:     For any real numbers $a$ and $b$, show that $$\max \{a,b \} = \frac{1}{2}(a+b+|a-b|)$$ and $$\min\{a,b \} = \frac{1}{2}(a+b-|a-b|)$$   So $a \geq b$ iff $a-b \ge0$ and $b \ge a$ iff $b-a \ge 0$. At first glance, it seems like an average of distances. For the first case, go to the point $a+b$, add $|a-b|$ and divide by $2$. Similarly with the second case.   Would you just break it up in cases and verify the formulas? Or do you actually need to come up with the formulas? What's the difference between correlation and simple linear regression? In particular, I am referring to the Pearson product-moment correlation coefficient. I need to refer to a model described elsewhere, from a section title, like  \section{Analysis of model X}    One way of referring to a model is to create a new counter, and then write  \section{Analysis of \cref{grandmodelofeverything}}   But now hyperref will complain because of invalid token, and it does not look good in the TOC either, especially since the titles of the sections the describe the models are more descriptive than  \section{Model 1}   They are currently like  \section{Adding the effect from Y processes}   Do I need to invent semi-descriptive long names like "The model by Authors with this modification" or can I live with these quirks? How can I prove that $xy\leq x^2+y^2$? How can I prove that $xy\leq x^2+y^2$ for all $x,y\in\mathbb{R}$ ? How do I map a network drive to the root of a server (\\server)? In Windows XP I can very easily map a network drive to the root of my NAS server. I browse to it in Explorer (\\192.168.1.70), choose "Map Network Drive", then choose the drive letter.  In Windows Vista, mapping the root of a server doesn't seem possible. I have to go "Map Network Drive" from 'Computer', then enter the address, but it will only let me map to specific shares (sub-folders off of the server root) and NOT to the server root share.   Since my NAS has built-in shares (music, photo, video, etc.) then I would have to have drive letters for all of these, which I absolutely don't want.  Why can I easily map a network drive to the server root in Windows XP, but not in Vista? Is there something fundamentally different in the networking across the two OS's? Or do I need to do things a different way? How to stream a video with VLC in a LAN That's kind of a recursive Google Search that should be self-explanatory. It did take me some time to tweak the sentence and trying to find a number which would correspond precisely, the reason why I changed it to "hundreds" instead! :P  If you have used Google long enough you certainly have stumbled on situations similar to this, many times. Whenever it shows less than 10 pages it's quite easy to see it. The point is: the number of results on any page except the last one seems like a terrible estimate.  What's even weirder,  the estimate suddenly becomes much better and almost exactly the same on all pages than it is on the last page - the only page that's always correct.  So, anyone knows why? Can a class overload methods that also exist in the publicly inherited interface? It seems like this is unambiguous and useful, but compilers (VC, Intel, GCC) all complain, at least by my construction. Below is a toy example. The inherited rebound() function has two clear overloads, yet this will not compile.  If you rename the rebound() method in either class, it works fine, but if they share the same member function name (even though they're overloaded with different argument types!) you get a fatal error of "too few arguments to function call."  The workaround is trivial (I'll just rename the methods) but I'm just trying to understand if this is a C++ restriction (and why it would be).   #include  class Bound { public:   Bound() : x0(0.0), x1(0.0) {};   Bound(double x) : x0(x), x1(x) {};   double width() const {return x1-x0;}   void rebound(const Bound *a, const Bound *b); private:   double x0, x1; };  void Bound::rebound(const Bound *a, const Bound *b) {   if (a && b) {     x0=std::min(a->x0, b->x0);     x1=std::max(a->x1, b->x1);   } }  class Node : public Bound { public:   Node(double x) : Bound(x), left(0), right(0) {};   Node(Node *a, Node *b) : left(a), right(b) {rebound();}   void rebound() { rebound(left, right); } private:   Node *left;   Node *right; };   int main() {   Node A(1.0);   Node B(2.0);   Node C(&A, &B); } How do I ensure that figures appear in the section they're associated with? Often floats may land quite a bit later in the document than the point they are created, sometimes after a section break.  Is there a way to force a new section to start on a new page, after any unplaced floats? How to make math font huge If $aRb \land bRc$ never occurs, is a relation considered transitive? Let $\omega := dx \wedge dy$ denote the standard area form on $\mathbb{R}^2$. As the question title suggests, does there exist a $1$-form $\alpha$ with $d\alpha = \omega$? While we know that every finite set is compact, how to prove that every infinite subset of $\mathbf{R}$, the set of all real numbers, is also compact in the finite-complement topology (also called the co-finite topology)?   What is the situation in the case of an arbitrary infinite set $X$ with the finite-complement topology? Return multiple values to a method caller How to get the Infobox data from Wikipedia? Lost credit card replaced with new card and new numbers. Credit score affected? I recently left my credit card at a bar so I reported it as lost to my bank, and my bank said I will get a replacement within a few days. For what it's worth, I picked my card up from the bar a few days later and made sure to cut it up.  The new credit card has arrived and has new numbers. Will this negatively affect my credit score?  VISA, Chase Bank, USA. Unsure whether to use "enquire" or "inquire"