I am making a quiz with Java, and an error has appeared. When I enter in the right answer, it says it is wrong. Any ideas?  Code:  package revision_project;  import java.util.List; import java.util.Scanner; import java.util.ArrayList;   public class Quiz {     public static void main(String args[]){         String newline = System.getProperty("line.separator");         Scanner input = new Scanner(System.in);          String[] questions = {"What is an integer?", "What does CPU stand for?", "How far can a LAN go?",                 "What does LAN stand for?", "Give an example of a WAN.", "What is a syntax error?"};         String[] answers = {"a whole number", "central processing unit", "2km", "local area network",                 "internet", "when the programmer enters in incorrect syntax."};         List&lt;String&gt; correct = new ArrayList&lt;String&gt;();          for(int i = 0; i &lt; questions.length; i++){             System.out.println(questions[i] + ": " + newline);             String x = input.nextLine();             x = x.toLowerCase();              if(x == answers[i]){                 System.out.println("Correct");                 //correct.add("Correct");             } else{                 System.out.println("Wrong");                 //correct.add("Wrong");             }         }                    } }
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?
Why do positive and negative variants of the same question elicit the same answer? Set a global policy for floats positioning I have a document with many floats (figures, specifically).  I want to be able to change the global floats positioning policy from htbp to just h (or even H with the floats package).  For my-own reasons, I don't want to do this by appending the [h] argument to each float env.  One option that I can think of is using a macro:  \newcommand{\mypos}{h} % or htbp \begin{figure}[\mypos]...   I also prefer not to do that - It is cumbersome.  Is there a way to set the global float positioning argument globally? Conjectures Involving floor(x)/piecewise continuity with regards to Integration and Differential Equations [This answer has been heavily edited in response to a long chain of comments on Eric Stucky's answer.]  I came up with these few theorems and I am curious whether or not my hypothesis are true. I don't really have a method for proving these, mind you. I'm more considering these as things I've noticed to be true. I just don't know whether they are always true.  Some of these are definitions to which I will append "def." to the end of the title. Think of these as a given. It's like how the integral is defined abstractly as area. I'm defining terms.  Jump Series Theorem def.  A function $f$ [consisting of floor] is said to have a jump series if there is a series $\Sigma=\sum_{n=1}^\infty a_nH_n$ of scaled step functions such that $f+\Sigma$ no longer has any discontinuity attributable to floor. The sequence of scaling factors $a_n$ is called the jump sequence for the function.  Definition of Implied Derivative def.  We define the evaluation of the implied derivative of a function $y$ at the point $x$ as the set of values $y^{\to}(x) = \{y | y = \lim_{h \to 0^+} \frac {y(x+h) - f(h)}{h} \lor y = \lim_{h \to 0^-} \frac {y(x+h) - f(h)}{h}\}$. It is in this sense that the implied derivative has the potential of being a multi-valued operator.  Jump Series Resolution Theorem  [The original wording is preserved; I have a formalism but it assumes that having a jump function is equivalent to being piecewise continuous, which I'm not sure is true.]   The integral of a floor-based function is floor treated as a constant minus the appropriate jump series of the integral.  Integration Continuity Theorem  The (ordinary) indefinite integral of any function $f$ having a jump series must be continuous (or fixably discontinuous) on the domain of $f$. However, this can vary for the implied indefinite integral.  Calculus Jump Theorem def.  [Again, the original wording is preserved; the meaning of this phrase has not been properly illuminated]  Any form of jumping within a function representable as a floor function can be considered as a portion of the constant of the implied integration for floor.  Jump Location Theorem  For any function $a(x)$ with a jump series, the function $\lfloor a(x)\rfloor$, has points of discontinuity precisely at those $x$ such that $a(x) - [a(x)] = 0$.  Composite Floor Function Jump Sequence Theorem One  If $a$ is a function such that $a(x) - \lfloor a(x) \rfloor = 0$ when $x - \lfloor x \rfloor = 0$, then the jump sequence of the composite function $f(x - \lfloor a\rfloor)$ is a constant value $f(0) - f(1)$.  Implied Differential Equations Conjecture  Any continuous solution to an equation constructed with implied derivatives of various orders is the same as the solution to the similarly constructed differential equation. How would you explain why $e^{i\pi}+1=0$ to a middle school student? Hi I was asked by a friends child who is in middle school why $e^{i\pi}+1=0$. Now I couldn't think of a way to explain it so he would understand. Albert Einstein once said “If you can't explain it simply, you don't understand it well enough” so how would I explain it. How do I figure out if someone is a first cousin, second cousin, cousin once-removed, etc? How big is my single pattern in Photoshop I pulled a repeating pattern from someone else's PSD. Is there a way to figure out the size of the original pattern? I need to create an image with only one tile. What is the capacity of this circuit? I simply can't figure out what the capacity of this circuit is.  I can do the math myself, I just need a hint how to create an equivalent circuit where it is obvious what is parallel and what is in series... df says I have 20G more disk space used than du. Why? Often when I edit one of my answers, it's because I want to better address the original question. The only problem is that I can't see the original question while I'm editing my answer!  I'd love to see the original question text beneath the "answer edit" form. This way I could scroll down slightly to read it if I wanted to, or just ignore it if not.  Current workaround is to click the 'return to answer' link and hope that you remember to launch it in a new tab/window, then tab back and forth.    Imported from this uservoice item: Terminal, how to quit --More-- list Is there a reason why "gn" in "reigning" is pronounced /n/ while in "regnant" it is pronounced [gn]? Both reigning and regnant are related to the same Latin noun, regnum.  Why is the ‹gn› spelling pronounced [n] in the first word but [gn] in the second? Order discrete x scale by frequency/value See dashboard as non logged user in community Is it possible, as a non logged user, to see report and dashboard in community when it is open to non logged user? And  for analytic dashboards? I get      every few minutes on Kubuntu (KDE), and the panels disappear.  It restarts itself automatically, so it's not a real problem, just an annoyance, but it is a big annoyance.  I've tried sudo apt install --reinstall plasmashell plasma-desktop, but that made no difference.  When I try a backtrace from the error message, it says it's unable to produce a useful backtrace. Let $X,Y,Z$ be subspaces of $V$ so that $X$ is a subspace of $Y$. Prove that $Y\cap (X+Z)=X+(Y\cap Z)$ Classifying whether a collection of objects is a set I'm wondering whether or not there is a definite criterion for determining whether a collection of objects is a set. In the literature, I've recently encountered some obscure examples (in Riemann Surface Theory, to be precise) of naturally-arising collections of objects which are not sets.   Here is some pseudo-rigor to make the question more precise:   Let $S$ be a collection of objects. Is there some property $P$ so that $S$ is a set iff $S$ has property $P$? How do I delete Windows.old in Windows? I used to run Windows 7 32 bit, but installed the 64 bit version because of a RAM upgrade. During the installation I got this message:      The partition you selected might contain files from a previous Windows installation. If it does, these files and folders will be moved to a folder named Windows.old. You will be able to access the information in Windows.old, but you will not be able to use your previous version of Windows.   The C:\ drive now has two (2) Windows folders:   Windows (15.3 GB) Windows.old (15.7 GB)     Don't see why I need the Windows.old taking over 15GB of space on my hard drive so I tried to delete it. It didn't work.  How can I safely delete this folder? Proving $(\forall a\in\mathbb{Z^+})(m\in\mathbb{Z^+}\to a^m\equiv a^{m-\phi(m)}\pmod{m})$ Problem: $(\forall a\in\mathbb{Z^+})(m\in\mathbb{Z^+}\to a^m\equiv a^{m-\phi(m)}\pmod{m})$  My work: Start by letting $m=p_1^{a_1}p_2^{a_2}\cdots p_r^{a_r}$. If $(a,p_i)=1$ for some integer $i$, then we have that  $$ a^{\phi(p_i^{a_i})}\equiv 1\pmod{p_i^{a_i}} $$ by Euler's theorem. Since $\phi(p_i^{a_i}) \mid \phi(m)$, we have that $p_i^{a_i}\mid (a^{\phi(m)}-1)$ if $(a,p_i)=1$.   Beyond this, I am stuck at the moment. My sister bought a used MacBook about 6 months ago and she has lost her password.  Here is the procedure I tried to use to reset the password:   Boot into single user mode (press Command-S at power on) Type fsck -fy Type mount -uw / Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist Type dscl . -passwd /Users/username password, replacing username with the targeted user and password with the desired password. Reboot   But when I try the step 4, it says launch_msg(): Socket is not connected.  I would like to know what command to enter in the single user mode to know what version the Macbook is running and the right command to reset the password. Thank you. Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask This is a  about Apache's mod_rewrite.   Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This includes such things as:   Changing HTTP to HTTPS (or the other way around) Changing a request to a page which no longer exist to a new replacement. Modifying a URL format (such as ?id=3433 to /id/3433 ) Presenting a different page based on the browser, based on the referrer, based on anything possible under the moon and sun. Anything you want to mess around with URL   Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask!  How can I become an expert at writing mod_rewrite rules?   What is the fundamental format and structure of mod_rewrite rules? What form/flavor of regular expressions do I need to have a solid grasp of? What are the most common mistakes/pitfalls when writing rewrite rules? What is a good method for testing and verifying mod_rewrite rules? Are there SEO or performance implications of mod_rewrite rules I should be aware of? Are there common situations where mod_rewrite might seem like the right tool for the job but isn't? What are some common examples?   A place to test your rules  The  web site is a great place to play around with your rules and test them. It even shows the debug output so you can see what matched and what did not.