I am a beginner to java. I developed a Java code to compare whether two user input Strings contain similar characters at equal frequencies and print them to the screen. But it shows a run time error ( ArrayOutOfBoundException ) during the compilation process. Help me to find the error.  import java.util.Scanner;  public class Checker {          public static void main(String[] args) {          Scanner scan = new Scanner(System.in);         String x = scan.next();         String y = scan.next();          boolean anws = similarCharctr(x, y);           System.out.println( (anws) ? "Similar" : "Dissimilar" );     }              static boolean similarCharctr(String x, String y) {         boolean status = false;          if(x.length() == y.length()){            status =  false;         }                         String e = x.toUpperCase();             String f = y.toUpperCase();             char c []  = new char[e.length()];            char d []  = new char[f.length()];             for(int i = 0; i&lt;c.length; i++){                c[i] = e.charAt(i);                d[i] = f.charAt(i);            }                for(int j = 0; j&lt; (c.length - 1); j++){                  for(int i = 0; i&lt; c.length; i++){                      if( c[j] &gt;c[i+1])                     {                         char temp;                            temp =   c[j];                        c[j] = c[i+1];                        c[i+1] = temp;                          char temp1;                            temp1 =   d[j];                        d[j] = d[i+1];                        d[i+1] = temp1;                        }            }            }                for(int i = 0; i&lt; c.length; i++){                  if(c[i] == d[i]){                       status = true;                 }                     else{                      status = false;                 }                }             return status;                  }         }
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?
Proof of $\sum_{k = 1}^{n} \frac{1}{k^{2}} < 2 - \frac{1}{n}$ Should I use single or double colon notation for pseudo-elements? Wasted screen space due to multiple horizontal bars at the top when an application is open in GNOME desktop Just moved from Unity to GNOME with the update to Ubuntu 17.10. There is a HUGE amount of wasted space at the top of the screen, when an application is open.  Evolution and Firefox both have four "bars" with 90% of each empty. Unity, to its credit was able to blend / mix these horizontal bars so there was only one / two.      Four is way too much. If this is GNOME I may carry on with Unity for the next six months.  Can anybody suggest a tweak/change/fix for this? What is the name of the depiction of concentration with raised eyebrow called? I have just created a Minecraft 1.13.1 server and was wondering if there was any way to give everyone the teleport command even if they are not op. If not, is there a way that I could make them op but only have access to the teleport command? Voltage Controlled Current Source integrated circuit? Exists? Does anyone know of a Voltage Controlled Current Source IC? Or do you know how I can build one with as few other components as possible taking up a minimal amount of space?  current range needed is from 0mA to 350mA How to interpret output from Linux 'top' command? Iterating each character in a string using Python In C++, I can iterate over an std::string like this:  std::string str = "Hello World!";  for (int i = 0; i &lt; str.length(); ++i) {     std::cout &lt;&lt; str[i] &lt;&lt; std::endl; }   How do I iterate over a string in Python? Induced metric on a null hypersurface Consider a metric $g_{\mu\nu}(x)$ and a hyper surface ${\cal H}$ defined by $~f(x) = c$. One (or at least I) usually finds the "induced metric" on ${\cal H}$ by solving$~f(x) = c$ for one of the coordinates and plugging it back into the metric to give us $\gamma_{ij}$. For null hypersurfaces, I seem to be finding that the resultant induced metric is singular.         Is it true in general that the induced metric as defined above is singular on a null hypersurface?   How does one define the induced metric on a null hypersurface? ETS() function, how to avoid forecast not in line with historical data? ODBC connection to Access database in 64-bit Windows Story where the hero ends up having his eyelids removed and being hooked up to some kind of virtual reality machine Trying to identify a short science fiction story where the protagonist is some kind of policeman or investigator, and at the end he chooses to live his life out hooked up to some kind of virtual reality machine. The ending describes him having his eyelids removed as he is attached to the machine, and then as the machine starts working he "becomes" a cowboy or some other western figure riding his horse downhill in a desert scene. How to use aes-encryption in PostgreSQL? I am trying to make a histogram with the fitted curve plotted on it. Here's the mwe:   \documentclass[a4paper]{scrartcl}     \usepackage{tikz}     \usepackage{pgfplots,pgfplotstable}     \usepackage{filecontents}     \pgfplotsset{compat=1.10}     \usepackage[active,tightpage]{preview}     \setlength\PreviewBorder{2pt}     \newcommand{\plots}{0.611201}     \newcommand{\plotm}{2.19882}     \begin{filecontents}{data.dat}     2 0.0629921259843     3 0.0236220472441     4 0.0314960629921     5 0.125984251969     6 0.0629921259843     7 0.102362204724     8 0.110236220472     9 0.0551181102362     10 0.0629921259843     11 0.0314960629921     12 0.0236220472441     13 0.0314960629921     14 0.0629921259843     15 0.0551181102362     16 0.0393700787402     17 0.0472440944882     18 0.00787401574803     19 0.0393700787402     24 0.00787401574803     27 0.00787401574803     33 0.00787401574803     \end{filecontents}     \begin{document}     \begin{preview}      \begin{tikzpicture}     \begin{axis}[     yticklabel style={/pgf/number format/fixed},     scaled y ticks = false,     minor y tick num={1},     xtick pos=left,     legend cell align = left,     legend style={draw=none},     xlabel = {group size},     ylabel = {ratio}     ]     \addplot[blue,ybar,fill, fill opacity=0.3, bar width = 0.8,] table {data.dat};     \addplot[red, line width = 1,domain=1:40,samples=100] {1/(x*sqrt(2*pi)*\plots)*exp(-(ln(x)-\plotm)^2/(2*\plots^2))};     \legend{empirical,lognormal fit}     \end{axis}     \end{tikzpicture}     \end{preview}     \end{document}     As you can see, the legend is not really good. How can I change the legend so it looks more like this? How do I duplicate a whole line in Emacs? Correct usage of "persons" (vs. "people") I had a little fight about persons vs. people.  Could you advise if both of the following are correct, if possible with reference to a dictionary?        A table for two people please.   A table for two persons please.      Besides that, how would you ask for a table in a restaurant?  I read  and , but they didn't really solve the question if both are correct.  I also found the last paragraph of , which suggests that (1) is "more correct", but doesn't say (2) is wrong. What happens when a moderator clicks 'leave open' in the close-vote queue? It takes  clicking "leave open" in the close-vote queue to remove the question from the queue.  How about diamond mods?  Do they remove it from the queue in one click, or not? I dont have a clue about the proof in the reverse implication on the iff statement.  I will show what I have by now:  1) A cofinite topology implies that any infinite subset in $X$ is dense. Let $U\in\tau$ and is cofinite topology so $U=X-\bigcup_{k=1}^{n}\{x_k\}$.  Let $V\in X$ an infinite subset then $$V\cap U=V\cap(X-\bigcup_{k=1}^{n}\{x_k\})=(V\cap X)-(V\cap \bigcup_{k=1}^{n}\{x_k\})=V-(V\cap \bigcup_{k=1}^{n}\{x_k\})$$  and cause $|V|\ge\aleph_0$ and $|\bigcup_{k=1}^{n}\{x_k\}|=n\in\Bbb N\,$ we have that $|V\cap \bigcup_{k=1}^{n}\{x_k\}|\le n$. And finally is obvious that $V-(V\cap \bigcup_{k=1}^{n}\{x_k\})\ne\emptyset$ so any infinite subset is dense on $X$.  2) A cofinite topology implies a $T_1$-space. Let $x, y\in X$ and $U\in\tau: U=X-\{y\}$ so $x\in U\land y\notin U$. We can define too $V\in\tau:V=X-\{x\}$ so $x\notin V\land y\in V$ then a cofinite topology is a $T_1$-space.  But my problem is that I dont have a clue to prove the reverse implication i.e. if we have a $T_1$-space where every infinite subset is dense then it is a cofinite topology. Some hint? Some advice or correction in the proof of above? Thank you in advance.    I will complete the proof with the advice of @Cameron Buie.  1) A $T_1$-space implies that any finite subset is closed. Let the singleton $\{x\}\subset X$. Then $\overline{\{x\}}=\{x\}\cup\{x\}'$ where $\{x\}'=\{y:(\forall U\in\tau : y\in U)\land x\in U\}$, but because we are in a $T_1$-space exist some $U$ for any points $x,y\in X: x\in U\land y\notin U$ so $\{x\}'=\emptyset$ then $\overline{\{x\}}=\{x\}$ and is closed.  This means that for every $T_1$-space it cofinite sets are open.  2) If any infinite subset is dense on $X$ it means that the closure of any infinite subset is $X$ so the only closed sets are finite (and $X$ itself), so the topology is cofinite. av_acharya@AnoxBotox:/$ wireshark qt.qpa.plugin: Could not find the Qt platform plugin &quot;xcb&quot; in &quot;path/to/plugins&quot; This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.   sudo apt-get install --reinstall qt5-default Reading package lists... Done Building dependency tree        Reading state information... Done The following NEW packages will be installed:   qt5-default 0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded. Need to get 0 B/24.4 kB of archives. After this operation, 170 kB of additional disk space will be used. Selecting previously unselected package qt5-default:amd64. (Reading database ... 241279 files and directories currently installed.) Preparing to unpack .../qt5-default_5.12.8+dfsg-0ubuntu1_amd64.deb ... Unpacking qt5-default:amd64 (5.12.8+dfsg-0ubuntu1) ... "Similar questions" overlaps footer and has no background When I can scroll down far enough to have the hot network questions overlap the footer (because my question is short) there is no background under the text:    Could they either be given a white background: (just disable the transparency option)    Or stop at the footer:      This also happens with the help text on some sites, as per this bug report:     Ubuntu 14.04.1 (Latest LTS Version), . Same problem with  and .  Windows 10 Pro,  and .  (Images linked to screenshot of browser)  My question is different from  because my issue is the lack of background on the footer.   I think there was a site redesign?