I've been racking my brain trying to figure out why my if statements won't print, can someone offer some help?  import java.util.Scanner;  public class Sound{      public static void main(String[] args){              Scanner x = new Scanner(System.in);              System.out.println("Enter the type of medium: ");             String medium = x.nextLine();             System.out.println("Enter the distance traveled: ");             double distance = x.nextDouble();            if(medium == "air"){             double time = distance/1100;             System.out.println("This is how long it takes: " + time);          }          else if(medium == "water"){             double time = distance/4900;             System.out.println("This is how long it takes: " + time);          }          else if(medium == "steel"){             double time = distance/16400;             System.out.println("This is how long it takes: " + time);          }       } }
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?
Laggy viewport in 2.9 when model has a lot vertices In Java, are enum types inside a class static? Why would a partition be in use by the system if it isn't mounted? I've been migrating my system from btrfs to ext4 after running into performance issues with VMs. I have two hard drives in my laptop to work with. I've successfully moved my home partition, but the same steps I used aren't working for root.  Progress so far:  I've dd'd my root partition from /dev/sda3 into /dev/sdb3. I modified /etc/fstab to the following:  $ cat /etc/fstab #  # /etc/fstab: static file system information # # &lt;file system&gt; &lt;dir&gt;   &lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt; # UUID=95f13c34-96ca-49e3-bcb2-ff594df31506 /dev/sdb3               /               btrfs           rw,noatime,ssd,space_cache,discard      0 0  # UUID=0fe04f59-599f-41e2-ac30-2ad0f17a9727 /dev/sda2               /boot           ext2            rw,relatime     0 2  # UUID=44741e0f-924a-4841-80ef-2132bef84182 /dev/sda4               /home           ext4            rw,noatime,discard      0 0   and run sudo mkinitcpio -p linux. It seems to work. I'm able to boot by mounting the partition on the second disk. df shows:  $ df Filesystem      Size  Used Avail Use% Mounted on /dev/sdb3        28G   18G  9.8G  65% /   So, clearly, sdb3 is mounted, not sda3. Here's the problematic step: When I try to format sda3, which is supposedly unused, I get the following:  $ sudo mkfs.ext4 /dev/sda3 [sudo] password for stew:  mke2fs 1.42.11 (09-Jul-2014) /dev/sda3 contains a btrfs file system Proceed anyway? (y,n) y /dev/sda3 is apparently in use by the system; will not make a filesystem here!   sda3 is in use. How and why could it possibly be in use?  As per casey's comment, the output of mount:  mount | grep sd /dev/sdb3 on / type btrfs (rw,noatime,ssd,discard,space_cache) /dev/sda4 on /home type ext4 (rw,noatime,discard,data=ordered) /dev/sda2 on /boot type ext2 (rw,relatime)   As per Warwick's comment, unmounting:  $ sudo umount /dev/sda3 umount: /dev/sda3: not mounted   Mounting and umounting sda3 elsewhere works successfully, but changes nothing.  Update: More fishy behavior:  $ mount | grep sd /dev/sdb3 on / type btrfs (rw,noatime,ssd,discard,space_cache) /dev/sda4 on /home type ext4 (rw,noatime,discard,data=ordered) /dev/sda2 on /boot type ext2 (rw,relatime) $ sudo mount /dev/sda3 mnt [sudo] password for stew:  $ mount | grep sd /dev/sda3 on / type btrfs (rw,noatime,ssd,discard,space_cache) /dev/sda4 on /home type ext4 (rw,noatime,discard,data=ordered) /dev/sda2 on /boot type ext2 (rw,relatime) /dev/sda3 on /home/stew/mnt type btrfs (rw,relatime,ssd,discard,space_cache)   After mounting sda3, sdb3 is no longer mounter. Weird, huh?  As per mikeserv:  $ rmmod btrfs rmmod: ERROR: Module btrfs is in use   This is very much expected, since sdb3 is btrfs and supposed to be mounted to root. From my mkinitcpio.conf file:  MODULES="" HOOKS="base udev autodetect modconf block filesystems keyboard fsck" Methods to compute $\sum_{k=1}^nk^p$ without Faulhaber's formula For a book cover, I want to write the title vertically (like in Japanese, but using English text):           T T        I H        T I  I  M  L S  S  Y  E   How do I do this without jumping through a host of \vbox and \hboxes? How to Toggle Selected Objects Visibility with H shortcut as in Maya I want to be able to toggle the visibility of selected objects with a shortcut (H) the way you can do in Maya and XSI, shown in the GIF. I'm guessing scrippting is needed. I've tried to do it my self but I'm new to Python and Blender and as soon as the objects are hidden they seem to no longer be in a selection state/list. Eg if I manually select the hidden object/s in the Outliner and try to print the selected object to the console, none seem to be selected. Is this possible to do with the current state of Blender 2.8? Custom pagebreak in align equation Why are my converted CMYK blacks coming out grey? I'm having a rather annoying problem! I have RGB images made in Photoshop that I need to convert to CMYK.  When I save the file my black background is converted to a light grey! I tried deleting my background and adding a pure black background in my PSD file but even that comes out grey! There is no way to save black? The colors all look fine in Photoshop, it's just when I save them as TIFF/JPEG.  How can I prevent this? How do I give a villager trades with custom NBT tags Show that $|f(z_1)|=|f(z_2)|≤|z_1|^2=|z_2|^2$. Let $f\in H(B(0,1))$, $f(0)=0$, $f(B(0,1))\subset B(0,1)$. Suppose there are 2 different points $z_1$,$z_2\in B(0,1)$, s.t. $|z_1|=|z_2|$, $f(z_1)=f(z_2)$. Show that $|f(z_1)|=|f(z_2)|≤|z_1|^2=|z_2|^2$.    I have used the Schwarz-Pick Proposition to prove that $|f(z_1)|=|f(z_2)|≤|z_1|=|z_2|$ directly, but that is not enough. Thank you for help! I am trying to create a beamer animation using tikz, but I can't even get basic rotating of a tikz image working as desired.  I have a rectangle specified by  \draw[rounded corners,dotted] (-3.5,0) rectangle (-0.5,2);   I would like to rotate this rectangle about the point (-1,.5) (which is near the bottom right corner of the rectangle).  I've tried:  {\rotatebox[origin=c,x=-1,y=.5]{130}{             \draw[rounded corners,dotted] (-3.5,0) rectangle (-0.5,2);}}   But this produces an error.  If I just use the origin=c option, it compiles, but it rotates the rectangle about the point (0,0).  I've also tried it with just the x=-1,y=.5 (without the origin option), and it fails to compile.  I have searched the documentation, which is where I learned about the options x=xdim and y=ydim.  However, I can't find a single example demonstrating how these options should be used.  Any suggestions would be greatly appreciated.    Also, if there is a better command for rotating things that will be more suitable for use in a beamer animation, please let me know.  Thanks! How to set the same font size for all tables? An operator on the other side of the Schrödinger equation A form of the  is  $$     \left[-\frac{\hbar^2}{2m} \nabla^2 + V(\vec{r}, t)\right]\Psi = i\hbar \frac{\partial}{\partial t} \Psi $$  The bracketed term is of course the Hamiltonian, and the whole equation can hence be written as  $$     \hat{H}\Psi = i\hbar \frac{\partial}{\partial t} \Psi $$  My question is, is there a existing/named operator represented by $i\hbar \frac{\partial}{\partial t}$? That is, can we further rewrite the equation as  $$     \hat{H}\Psi = \hat{\Theta}\Psi $$  For some predefined operator $\hat{\Theta} = i\hbar \frac{\partial}{\partial t}$? Where are the default settings saved for the Command Prompt defaults?  Are they stored in the registry somewhere, or in a file?  I would love to make a .reg file to set my default preferences when logging into a machine for the first time.  I'm talking about the default application settings: QuickEdit mode, buffer size, text color, etc. How do I URL encode a string Show that if $u$ is harmonic in $\mathbb R^n$ and $u=o(|x|)$, then $u$ is a constant.(Hint: use the solid version of the mean value property $u(x)=\frac{1}{\omega R^n} \int _{B_{R(x)}} u(y)dy$, and estimate $|u(x)-u(x')|$.)  Can anyone tell me how to use this hint? Shouldn't it be "he was the most famous fighter to have ever lived"? Creating a unique alphanumeric 10-character string I'm looking to create a simple short-lived reservation system, and I'd like to generate confirmation numbers that are   unique random-looking alphanumeric short-ish, at least much shorter than 32 character-long strings returned by sha1   I'm only looking to have ~500 reservations, so I don't imagine high likelyhood of collissions.  One idea I had is generate an sha1 hash based on a date-time stamp and username, then truncating it to its first 10 characters.  Would something like that be reliably unique enough for the purposes of processing ~500 reservations? Recovering eigenvectors from SVD Over the course of time here on TSE, I have observed individuals whose pattern of visa applications is best described as ''...     serial refusals - Two or more consecutive visa refusals issued by the same regime to the same person. Commonly for the same, or nearly the same, reasons. In some visa regimes Serial refusals can have a cumulative effect wherein the applicant's credibility is increasingly eroded, especially when the application pattern suggests a secondary agenda.   A common thread appears to be the need to visit the destination country (especially Schengen, the USA, or the UK) with a special sense of urgency. Also common in these cases are the following types of questions...   Should I just reapply once again? What are my chances? What can I do to improve my odds in the future? Can I somehow address the previous refusals to avoid them being a burden on all future applications? How can I break the pattern?      NB: This question is intended as a canonical about serial refusals. I have never been personally denied a visa.