These are the steps I am stuck on in my programming assignment:   Create a while loop that will run until the user types in the exit command at the menu. a. After the loop print a goodbye message.  Within the loop determine which menu choice the user picked and do the appropriate action. The different possible actions are defined in the following steps. a. Don’t forget to take a new input from the user after you’ve processed their choice.   Here's my code I'm not sure what to change because when I input a character it won't display the if command it's assigned too.  import java.util.*;  public class Assignment5KJ { static Scanner scan = new Scanner(System.in);  public static void main(String[]args) {     Pet pet1 = new Pet("Fido", 3);     Pet pet2 = new Pet("Furball", 1);     Pet pet3 = null;      System.out.println("Welcome to my pet store.");     list(scan);       do     {                     if(list(scan).equals("A"))         {             System.out.println(pet1.getName() + " is " + pet1.getAge() + " years old and " + pet1.getAdopt() + ".");             System.out.println(pet2.getName() + " is " + pet2.getAge() + " year old and " + pet2.getAdopt() + ".");             if (pet3 != null)             {                 System.out.println(pet3.getName() + " is " + pet3.getAge() + " years old and " + pet3.getAdopt() + ".");             }             list(scan);         }         else if(list(scan).equals('B'))         {             pet1.setAge(3);             pet2.setAge(1);             list(scan);         }         else if(list(scan).equals("C"))         {             if(pet3 != null)             {                 System.out.println("The pet store is full.");             }             else             {                 System.out.println("Enter a name for the new pet");                 String name4 = scan.nextLine();                 System.out.println("Enter an age for the new pet");                 int age4 = scan.nextInt();                 Pet pet4 = new Pet(name4, age4);                 pet3 = pet4;                 System.out.println(pet4.getName() + " has been added to the store.");             }                                                              list(scan);         }      }          while(!list(scan).equals("E"));      System.out.println("Have a nice day."); }   public static String list(Scanner scan) {     String list = "\n" + "A. List the pets in the store." +             "\n" + "B. Age up the pets" +             "\n" + "C. Add a new pet" +             "\n" + "D. Adopt a pet" +             "\n" + "E. Quit";     System.out.println("Type the letter to make your selection." + list);     scan = new Scanner(System.in);     char selection = Character.toUpperCase((scan.next().charAt(0)));      while (!(selection &gt;= 'A' &amp;&amp; selection &lt;= 'E'))     {          System.out.println("Not a valid selection.");          selection = Character.toUpperCase((scan.next().charAt(0)));     }      return selection + ""; }  public static boolean isValidInput(char selection) {     return (selection &gt;= 'A' &amp;&amp; selection &lt;= 'E'); }   }   public class Pet {     private String name;     private int age;     private boolean adoptStatus;  public Pet() {     name = "";     age = 0;     adoptStatus = false; }  public Pet(String petName, int petAge) {     name=petName;     age=petAge; }  public void setName(String name1) {     name=name1; }  public String getName() {     return name; }  public void setAge(int age1) {     age = age1++; }  public int getAge() {     return age; }  public void Adopt() {     adoptStatus = true; }  public boolean getAdopt() {     return adoptStatus; } }
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?
How to replace a string with a string containing slash with sed? I am looking for a way to replace a string in a file with a string that contains a slash by using sed.  connect="192.168.100.61/foo" srcText="foo.bar=XPLACEHOLDERX" echo $srcText | sed "s/XPLACEHOLDERX/$connect"   The result is:  sed: -e Expression #1, Character 32: Unknown option for `s' I generated a key and copied it to my target:  ssh-keygen ssh-copy-id username@hostname   I left the the location of the key as default and did not set any passphrase.  For a small while after that, I was able to ssh username@hostname without being prompted for a password, and then it stopped working for some reason. ArrayList contains case sensitivity I am having the following equation:  \begin{equation}   Q(\lambda,\hat{\lambda}) = -\frac{1}{2} P(O \mid \lambda ) \sum_s \sum_m \sum_t \gamma_m^{(s)} (t) \left( n \log(2 \pi ) + \log \left| C_m^{(s)} \right| + \left( \mathbf{o}_t - \hat{\mu}_m^{(s)} \right) ^T C_m^{(s)-1} \left(\mathbf{o}_t - \hat{\mu}_m^{(s)}\right) \right) \end{equation}   which does not very well fit on one line. How can I split this over two lines? What I have in mind is that I specify the splitting place, and that the first line is left aligned and the second line right aligned to make clear that it is still the same equation.  The linebreak \\ does not work. Consider this reverse biased diode :     I read that no or very small current flows in reverse biased diode as depletion layers get widened and huge resistance is offered so no electrons can cross it. But, why the electrons or holes need to cross the depletion layer? In the diagram above, the positive charges (holes) are moving towards left and the current due to electrons is also in left, so won't the circuit be completed? TikZ: multiple decorations on a path. If I attempt to change my password to nothing by opening "User Accounts", the "Change" button remains greyed out:    How do I change my password to be empty? I know you can set Ubuntu to automatically log you in, but I want my password to be empty, I never want to type in a password to authenticate myself as that user.  I know that there are reasons why this might not be a good idea, but I want to know if it is even possible. I'm using Ubuntu 12.10. Difference between $:=$ and $=$ I am sorry if this is quite elementary question. But I always think, that why we use $:=$ at some places, instead of $=$. Is there any fundamental difference between these two? Before reading Terry Tao's blog (4 months ago), I had never seen a symbol like this (:=). I'd really like to learn how to play pen-and-paper RPGs.  I know that it takes a few players to actually sit down and play, but I'm not at all sure where to find more gamers.  How do I find existing groups to join? Or, are there any resources online that may help me find existing RPG groups or players? Great Theorem - Help name the Sci-fi book read long ago I'm trying to find a book I read long back. This book may have won a Hugo/Nebula (Trust me I've googled to death this one!).  Don't remember much of the story (that's why I want to re-read it). What I remember is that some of the powers in the book are called "Gods". And they have brains the size of the planets (or planets being their brains).  The protagonist in the climax, solves a theorem (The Great Theorem, perhaps) by remembering one of the obscure theorems (Jacuzi (?)) and incorporating it. This [Great] theorem helps spaceships helps find the shortest route from point A to B. He surprises the antagonist by reaching the vantage point quickly with the help of his new knowledge, and blasts his enemy's spaceship.  The ending of the book - as I remember it is - that the protagonist wants to become a God himself.  Please let me know the title &amp; author of this book if you've read it.  PS #1:  BTW, It's not Asimov's The Gods Themselves :) PS #2:  It's published at the least before 1998 CSS: Special Fluid Layout Problems How to find out the variant of my Galaxy Nexus? How to define a bijection between $(0,1)$ and $(0,1]$?   Or any other open and closed intervals?   If the intervals are both open like $(-1,2)\text{ and }(-5,4)$ I do a cheap trick (don't know if that's how you're supposed to do it): I make a function $f : (-1, 2)\rightarrow (-5, 4)$ of the form $f(x)=mx+b$ by \begin{align*} -5 = f(-1) &amp;= m(-1)+b \\ 4 = f(2) &amp;= m(2) + b \end{align*} Solving for $m$ and $b$ I find $m=3\text{ and }b=-2$ so then $f(x)=3x-2.$  Then I show that $f$ is a bijection by showing that it is injective and surjective. Link to the recommended job is broken in the mobile apps The link to the recommended job in the app brings you to a page with the text: Not Found    Looking at the link it seems like after changing the URL structure in Stack Overflow Jobs they have not been updated in the apps.  For the job in the screenshot this is the used URL in the app:    The correct URL is: Order of finite fields is $p^n$ Let $F$ be a finite field. How do I prove that the order of $F$ is always of order $p^n$ where $p$ is prime? What do you call a person who does/thinks the opposite of the crowd for just that reason? Such a person does not hold in high regard the decisions taken by a group (not a team) of people. She believes that groups tend to be anarchic and don't serve their purpose.  An example would be - for outings with friends, this person will not like planning it with the group since they will mess it up.  Therefore, this person has convinced herself that when more people are involved with something, it will be worse. She distrusts crowds instinctively basically. $\LaTeX$ and Mathematica Put   $$ l^{\infty} = \{ (x_n) \subseteq \mathbb{C} : \forall j \; \;\ \;|x_j| \leq C(x)\} $$  I want to show that $c_0$, the space of all sequences of scalars that converges to $0$ is closed subspace of $l^{\infty}$.  MY atttemt: Take arbitrary sequence $(x_n) \in c_0$. We know $x_n \to 0$. but $0 \in c_0$. Therefore, every sequence in $c_0$ converges to an element in $c_0$. Hence, $c_0$ must be closed  Is this correct? thanks Why does my regular expression work in X but not in Y? Resources for Blender Since asking for tutorials, videos, resources, links to other content or downloads is considered off topic here, this is a specifically created Community Wiki which gathers resources for Blender and it has been approved by the .  Just write in the appropriate answer/section. If you have concerns, questions, post a  question, so we don't clutter the comments, but you can link your meta question from the comments.  Questions regarding such resources are not allowed anymore, except for very specific and on topic requests (ask on  if you're unsure about your question). Follow the instructions made in the question about how to post, what can be posted, etc.  Learning             Assets    (also see: )   Reference Images/Blueprints (also see: )    Tools    (also see: )      Other   Special Interest ()     Also see the .