I'm making a game where the user enters his/her first name and last name. The program extracts the first letters from the names, then outputs names from a string array.   I'm thinking the issue is in the last part of the code, where I'm comparing the Strings firstletter and lastLetter to the array. But I'm not sure. I have spent some time researching, and I'm stuck.   Any comments welcome. You won't hurt my feelings.   import java.util.Arrays; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Scanner;   public abstract class ChristmasName extends JFrame implements ActionListener {   public static void main(String[] args) {      JFrame frame = new JFrame("What is your Christmas Name?");     frame.setVisible(true);     frame.setSize(400,300);     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      JPanel panel = new JPanel();     frame.add(panel);      JLabel firstName = new JLabel("First name:");         JTextField first = new JTextField(15);     JLabel lastName = new JLabel("Last name:");         JTextField last = new JTextField(15);     panel.add(firstName);     panel.add(first);     panel.add(lastName);     panel.add(last);      JButton submit = new JButton("Submit");     panel.add(submit);     submit.addActionListener(new ActionListener() {          @Override         public actionPerformed(ActionEvent e) {            String[] first_name = {"Apple","Eggnogg","Candy","Jingle","Holly","Goldie","Ho Ho","Frosty","Joyous","Mittens","Tinsel","Turkey","Tiny","Cranberry","Bloated","Angel","Bauble","Bulb","Ginger","Blitzen","Eve","Faith","Fruitcake","Goose","Glitter","Grinch"};            String[] last_name = {"Tidings","Swan","Jolly","Claus","Mistletoe","Punch","Chimney","Coal","Igloo","Jumper","Myrhh","Pudding","Reindeer","Rejoice","Icicle","Midnight","Shepherd","Surprise","Gift","Magi","Train","Tree","White","Donkey","Wreath","Stuffing"};             String firstLetter = first.getText();            firstLetter = firstLetter.substring(0,1);             String lastLetter = last.getText();            lastLetter = lastLetter.substring(0,1);             if (firstLetter == "A") {                firstLetter = first_name[0];             }               JOptionPane.showMessageDialog(null, firstLetter + " " + lastLetter);            System.exit(0);              }     });      }   }
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?
Helvetica font has jagged edges I use 'Helvetica' as my font and build my document using Texmaker. But the PDF generated has jagged edges while using this font and when I use a different font (say Times or even Helvetica sans-serif) it builds just fine.     Please suggest if there is anyway I can get over this. The problem with these jagged edges is that it appears very dull and unreadable at 100% resolution.  OK guys, now here is the MWE  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper,twoside,12pt]{book}  %% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} %\usepackage[utf8]{inputenc} \usepackage{graphicx,color,subfigure}  %% Line Spacing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{setspace} %\singlespacing        %% 1-spacing (default) %\onehalfspacing       %% 1,5-spacing \doublespacing        %% 2-spacing  %% Other Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[left=1.5in, right=1.5in, top=1in, bottom=1in, includefoot, headheight=13.6pt]{geometry} \usepackage[pagebackref=true,breaklinks=true,letterpaper=true,colorlinks,bookmarks=false]{hyperref} \usepackage{helvet} \usepackage[square,numbers]{natbib} \usepackage{hyphenat} \usepackage{fancyhdr}   \begin{document}  \pagestyle{empty} %No headings for the first pages.  \cleardoublepage %The first chapter should start on an odd page.  \pagestyle{plain} %Now display headings: headings / fancy / ...  \pagebreak  %------------------------------------------------------------------------ \chapter{Divorce}   A major change that has occurred in the Western family is an increased incidence in divorce. Whereas in the past, divorce was a relatively rare occurrence, in recent times it has become quite commonplace. This change is borne out clearly in census figures. For example thirty years ago in Australia, only one marriage in ten ended in divorce; nowadays the figure is more than one in three (Australian Bureau of Statistics, 1996: p.45). A consequence of this change has been a substantial increase in the number of single parent families and the attendant problems that this brings (Kilmartin, 1997).   \end{document} In a race there are n horses.In the race more than one horse may get the same position. For example, 2 horses can finish in 3 ways.   Both first horse1 first and horse2 second horse2 first and horse1 second   In how many ways,the race can finish so that a particular horse can never be first.If f(n) is the number of ways, is there any recurrence relation to get f(n). Why does this stream return no element? Is there a theorem that says that QFT reduces to QM in a suitable limit? Of course, it should be, as QFT is relativisitc quantum mechanics. But, is there a more manifest one? such as Ehrenfest's theorem which dictates the transition from QM to Classical Mechanics.  I am curious as the basic object in QM is wave function whereas the basic object in QFT is quantized operator, which looks very different, and wondering how the comparison works.  (Of course, I am aware that QFT can calculate corrections for Coulomb potential energy, which may seem to be a transition from QFT to QM, but I want one more manifest than that.) When did the 5-foot square/hex become the standard unit of measurement in Dungeons & Dragons? I've searched for multiple forums for this questions and have seen different answers but so far, nothing have worked yet even from the ones I've seen here.  I want to extract a single file from a tar to a different directory.  I've tried this:  tar xvf file.tar -C /home/dir/ filename   or this:  tar -x filename -f file.tar -C /home/dir   But got these errors respectively:  x filename, 14826 bytes, 29 media blocks. File -C not present in the archive. File /home/dir not present in the archive.   and:  tar: /dev/rmt0: A file or directory in the path name does not exist.   The first extracted the file but in the same directory, not to the folder I wanted. Why didn't Dumbledore prevent the prosecution of Sirius Black? Dumbledore performed the Fidelius charm on the Potters, so he knew who the Secret-Keeper was1. That implies he knew not Sirius but Wormtail betrayed the Potters. Why didn't he prevent Sirius's conviction and suspect the explosion killing twelve Muggles was caused by Wormtail (and that Sirius cornered Wormtail instead of the other way around)?   1: Though in  it is said Dumbledore didn't know. I find it hard to believe the person casting the Fidelius charm doesn't know who the Secret-Keeper is. All my properties are zero, and my array is zero, even though I have populated them with numbers and objects Construction of a Borel set with positive but not full measure in each interval I wrote a DLL in .NET and I want to access it in VBScript. I don't want to add it to the assembly directory.   Is there a way to point too the DLL and create an instance of it? First of all, I think this question is not duplicated, because I have tried all other solutions I found here, but nothing solved my problem.  I use Ubuntu 14.04 64 bit.  I have tried until now: sudo apt-get install skype -> It didn't work. The error was:   The following packages have unmet dependencies: skype : Depends: skype-bin E: Unable to correct problems, you have held broken packages.   I have tried sudo dpkg add-architecture &amp;&amp; sudo dpkg -i skype-ubuntu-precise_4.3.0.37-1_i386.deb but it didn't work either. The error was:  dpkg: dependency problems prevent configuration of skype: skype depends on libqt4-dbus (&gt;= 4:4.5.3); however: Package libqt4-dbus is not installed. skype depends on libqt4-network (&gt;= 4:4.8.0); however: Package libqt4-network:i386 is not installed. skype depends on libqt4-xml (&gt;= 4:4.5.3); however: Package libqt4-xml:i386 is not installed. skype depends on libqtcore4 (&gt;= 4:4.7.0~beta1); however: Package libqtcore4:i386 is not installed. skype depends on libqtgui4 (&gt;= 4:4.8.0); however: Package libqtgui4:i386 is not installed. skype depends on libqtwebkit4 (&gt;= 2.2~2011week36); however: skype depends on libstdc++6 (&gt;= 4.2.1); however: Package libstdc++6:i386 is not installed. skype depends on libx11-6; however: Package libx11-6:i386 is not installed. skype depends on libxext6; however: Package libxext6:i386 is not installed. skype depends on libxss1; however: Package libxss1:i386 is not installed. skype depends on libxv1; however: Package libxv1:i386 is not installed. skype depends on dpkg: error processing package skype (--install): dependency problems - leaving unconfigured Processing triggers for hicolor-icon-theme (0.13-1) ... Processing triggers for gnome-menus (3.10.1-0ubuntu2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu1) ... Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for mime-support (3.54ubuntu1) ... Errors were encountered while processing: skype   I have tried to use after sudo apt-get -f install but it didn't solve the issue.  I have tried to install by using Gdebi. The error was:  Cannot install 'libqtwebkit4:i386'   I have tried to install using Ubuntu Software Center. The error was:  Cannot install 'libqtwebkit4:i386'   I have tried changing the server in "Software and Updates". I have tried to use "Main Server" and "Servers for United States". But it couldn't solve my problem.  Anyone has any idea how to solve that?  SOLVED  Well, I formatted my pc and I installed Skype first of all. Probably another installation that I had done before the Skype installation was the problem, i guess.  Thanks people! Is there a way to arrange windows within the same application in the taskbar of Windows 7?  Right now we can freely adjust each application's position in the taskbar, but within the app itself the windows can't be reordered, for example multiple windows of firefox or chrome. (Re?)Install Ubuntu on a Dell laptop that had Ubuntu preinstalled FPDF error: Some data has already been output, can't send PDF How to remove uninstalled snaps from cache? I have a desktop (Ubuntu 13.04 &amp; Win 7 Home Premium) and a Laptop (Ubuntu 12.04), both having WiFi adapters. I also have a WiFi router connected to internet which both my computers can access.  I want to share files between my desktop and my laptop using WiFi (similar to Homegroup on Windows 7 but without using Ethernet cables).  How do I set-up that?  I want to share files using both OSs, if anyone have have information about sharing files with any of the OS please answer! window-switching keyboard shortcuts interfere with emacs and cannot be changed in the main keyboard system preferences I'm starting a very long quest to learn about math, so that I can program games. I'm mostly a corporate developer, and it's somewhat boring and non exciting. When I began my career, I chose it because I wanted to create games.  I'm told that Linear Algebra is the best place to start. Where should I go? What are neutral density filters and how do I use them to create long exposures in daylight? I've seen a few related posts on the site but nothing specifically on this point:  I'd like to be able to take long exposure photos during daylight (like the examples in ). I'm told that you can do this by using a neutral density filter. So my question is: what is a neutral density filter exactly, and how is it used to achieve that smooth long exposure effect? First part :  I want to prove the following De Morgan's law :  ref.(dfeuer)  $A\setminus (B \cap C) = (A\setminus B) \cup (A\setminus C) $    Second part:  Prove that $(A\setminus B) \cup (A\setminus C) = A\setminus (B \cap C) $    Proof:  Let $y\in (A\setminus B) \cup (A\setminus C)$     $(A\setminus B) \cup (A\setminus C) = (y \in A\;  \land y \not\in  B\;) \vee (y \in A\; \land y \not\in C\;)$      $\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;= y \in A\ \land (  y \not\in B\; \vee \; y \not\in C ) $      $\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;= y \in A \land  (\lnot ( y\in B) \lor \lnot( y\in C) )$   According to De-Morgan's theorem :  $\lnot( B \land C) \Longleftrightarrow (\lnot B \lor \lnot C)$ thus     $y \in A \land (\lnot ( y\in B) \lor \lnot( y\in C) ) = y \in A \land y \not\in (B \land C)$   We can conclude that  $(A\setminus B) \cup (A\setminus C) = A\setminus (B \cap C)$