I am not sure what exactly is wrong with my code. I am just testing out the logic for an 'if' 'else if' 'else' code block. I ran the program and each time I typed in one of the 3 fruits mentioned in the prompt, all I get is the print statement from the else block. I did a debug and the code is not even stepping into the curly braces meant for the if block of the respective fruit. Hope someone can tell me what is wrong with my code. Thank you.  import java.util.Scanner;   public class IfDriver {      public static void main(String[] args) {         Scanner sc = new Scanner(System.in);         String s=null;         System.out.println("Please enter the fruit: ");         String fruit = sc.next();         if(fruit=="apple"){             System.out.println("It is an apple");         }         else if(fruit=="orange"){             System.out.println("It is an orange");         }         else if(fruit=="pear"){             System.out.println("It is a pear");         }         else {             System.out.println("No such fruit");         }     } }
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?
Creating geodatabase feature class using geodatabase table schema with ArcPy? Is there a way in ArcPy to create an empty polygon geodatabase feature class that will acquire the schema of a geodatabase table?  I know that it's possible in ArcCatalog (New -> Feature Class and then import all the fields from a table) but I wonder if it can be written in a Python script.  The CreateFeatureclass_management tool allows only Feature Layers as schema templates. If $S$ is a finitely generated graded algebra over $S_0$, $S_{(f)}$ is finitely generated algebra over $S_0$? Let $S = \bigoplus_{n\ge 0} S_n$ be a graded commutative ring. Let $f$ be a homogeneous element of $S$ of degree $&gt; 0$. Let $S_{(f)}$ be the degree $0$ part of the graded ring $S_f$, where $S_f$ is the localization with respect to the multiplicative set $\{1, f, f^2,\dots\}$. Suppose $S$ is finitely generated algebra over $S_0$. Then $S_{(f)}$ is a finitely generated algebra over $S_0$. Proofs of AM-GM inequality The arithmetic - geometric mean inequality states that $$\frac{x_1+ \ldots + x_n}{n} \geq \sqrt[n]{x_1 \cdots x_n}$$ I'm looking for some original proofs of this inequality. I can find the usual proofs on the internet but I was wondering if someone knew a proof that is unexpected in some way. e.g. can you link the theorem to some famous theorem, can you find a non-trivial geometric proof (I can find some of those), proofs that use theory that doesn't link to this inequality at first sight (e.g. differential equations …)?  Induction, backward induction, use of Jensen inequality, swapping terms, use of Lagrange multiplier, proof using thermodynamics (yeah, I know, it's rather some physical argument that this theorem might be true, not really a proof), convexity, … are some of the proofs I know. Is the XP for an encounter split among the party members or not? At this point, I am unclear as to how to handle encounter XP. Does each surviving party member receive a proportional share, or the full amount? That is, assume a 4-character party had completed an encounter worth 400 XP. Would each party member receive 100 XP, or 400 XP? Derivative of $(y-XB)' h(y-XB)$ with respect to $B$ Let $G$ be a finite semi-group with identity such that it has only one idempotent.Is $G$ a group?  It only remains to show that for any $a\in G$ $\exists b\in G$ such that $ab=ba=e$ where $e$ is the identity of $G$  Also $e$ is the only idempotent of $G$ .How to proceed next? Did English ever have a word for 'yes' for negative questions? The Germans have doch and the French have si as a word that means "yes" in response to a negative question, such as:     Don't you want some ice-cream?   Yes [I do]!   In English, we only have yes (as far as I know) and further clarification is required in order to be unambiguous.  Did we ever have such a word in English and, if so, what happened to it? If not, given the French and Germanic influences on English, any idea why not? If $f: \mathbb Q\to \mathbb Q$ is a homomorphism, prove that $f(x)=0$ for all $x\in\mathbb Q$ or $f(x)=x$ for all $x$ in $\mathbb Q$.  I'm wondering if you can help me with this one? Asymptotic expansion for Fresnel Integrals If you take the fresnel integrals to be $$S(x) = \int_{0}^{x}\sin \left(\frac { \pi \cdot  t^2}{2} \right) dt$$ How do you find the asymptotic expansion? I know it begins with a $1/2$ but how? Any good relational database tutorials? Why can't we see infrared light? Can anyone recommend a good exposition of the theory behind partial least squares regression (available online) for someone who understands SVD and PCA?  I have looked at many sources online and have not found anything that had the right combination of rigor and accessibility.    I have looked into The Elements of Statistical Learning, which was suggested in a comment on a question asked on Cross Validated, , but I don't think that this reference does the topic justice (it's too brief to do so, and doesn't provide much theory on the subject).  From what I've read, PLS exploits linear combinations of the predictor variables, $z_i=X \varphi_i$ that maximize the covariance $ y^Tz_i $ subject to the constraints $\|\varphi_i\|=1$ and $z_i^Tz_j=0$ if $i \neq j$, where the $\varphi_i$ are chosen iteratively, in the order in which they maximize the covariance.  But even after all I've read, I'm still uncertain whether that is true, and if so, how the method is executed. How to get file creation & modification date/times in Python? I have a script that needs to do some stuff based on file creation &amp; modification dates but has to run on Linux &amp; Windows.  What's the best cross-platform way to get file creation &amp; modification date/times in Python? How to make an embedded question from "What time is it?" Most descriptions of SIGTERM and SIGKILL point out that SIGKILL,     In contrast to SIGTERM and SIGINT, [...] cannot be caught or ignored [...] ()   Is this the only difference between SIGTERM and SIGKILL? In particular, if a process does not install a SIGTERM handler, is there any difference at all between sending SIGTERM or SIGKILL to the process? Are there any examples of subspaces  of $\ell^{2}$ and $\ell^{\infty}$ which are not closed? Which Google Updater is the one that I should allow to run? Can I force an iPhone user to upgrade an application? Explicit vs implicit SQL joins Is there any efficiency difference in an explicit vs implicit inner join? For example:  SELECT * FROM table a INNER JOIN table b ON a.id = b.id;   vs.  SELECT a.*, b.* FROM table a, table b WHERE a.id = b.id; If I have Optimize iPhone Storage enabled on my iPhone and my phone storage is completely full, I understand that iOS will only store a low-res thumbnail of many of my photos on the device. (The full high-res version of the image will only exist in iCloud and on devices with Download and Keep Originals enabled.)  But when only thumbnails exist on the device, how does that work in relation to other photo apps on iOS? For example, do third-party cloud-based photo apps (like Google Photos, Dropbox's Carousel, or Amazon Prime Photos) have access to the full high-res images from the iCloud Photo Library? Or will they only see the low-res thumbnails in some cases?