Why is the output of this 11?

public class Test4
    public static void main(String[] args)
        int x = 2;
        x = ++x + x++ + ++x;
        System.out.print(x); // Prints 11
}

Uuuupss.
I said "maybe".
The logic behind this is that;
++x return the incread value
x++ return the nonincreased value.Can the increment operators said to be returning
anything at all? Not sure - I wouldn't say it.Yeah, "return" is not the correct term.
They are expressions, and the expressions have values. The value of the x++ expression is x's original value, and the value of the ++x expressions is x's incremented value.

Similar Messages

  • Why does the Safari message "This is a non-secure form" pop up everytime I try to use yahoo mail?

    Why does the Safari message "This is a non-secure form" pop everytime I go into yahoo mail?  If I don't press the send option my whole computer freezes.

    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • Why is the output file jerky ?

    Hi there,
    I have AE CS5 on my Mac. My system is 27" iMac core i5 with 12 GB RAM DDR3 1333 MHz with quad core.
    I rendered a 40 seconds clip with an earth spinning.
    I output it to mov format in 1920 x 1080.
    When I did a RAM preview, it was fine & the earth was spinning smoothly.
    But the output file (in mov) - (I did thru Composition > Make movie) when I play using QuickTime player is jerky at 20th Sec to 29th sec.
    I then import this mov file into Final Cut, it look stuck in the Viewer but was perfect on the Canvas.
    When I render in Final Cut, the output file as mov and use the same Quick Time player to play it & it is perfect.
    Can I know what is the reason that it is not working in Quick Time the first time when it was fresh out from AE ?
    Thank you.
    Cheers

    The default render settings use Quicktime Animation codec at best quality. These files will not playback smoothly because the data rate is too high for the hard drives to keep up with. The animation codec is a lossless codec designed not designed for playback.
    Final Cut uses compressed codecs designed for playback as the default. I'd suggest that you open up the help files (F1) and read the entire section on Rendering and Exporting (link).

  • Why is the output

    Hi. How come the output of the code below is "FALSE"?
    Im actually suppose to use a bean here but to simplify, I made it as inner class.
    public class TestString {
         MyAccount account = new MyAccount();
         public TestString(){
              account.setPremiumType("Motorcyle");
              String type = account.getPremiumType();
              if (type == "Motorcycle")
                   System.out.println("TRUE 1");
              else if (type.equals("Motorcycle"))
                   System.out.println("TRUE 2");
              else System.out.println("FALSE");
         class MyAccount{
              String type;
              public MyAccount(){
              void setPremiumType(String type){
                   this.type = type;
              String getPremiumType(){
                   return type;
         public static void main(String[] args){
              new TestString();
    }

    LOL. That was a good one.I was staring at it for a good long while, thinking it must be some weird quirk having to do with order of instantiation/initialization for nested classes. When I actually saw it, I blurted out "oh, fuck." My not-quite-four-year-old looked up from where he was almost falling asleep and asked "What?"

  • Can I use Flash Develop to view the output of this program?

    The author of this program:
    http://www.ffiles.com/flash/particle_effects/lightning_generator_2520.html
    Has made his source code available.
    If I click the Test Movie button in Flash Player with any of the .as files open, it'll open up the Flash debug player, but I don't see the lightning. Is there something I'm missing?

    Instead of doing the above, could I simply replace my Verizon router with an Airport and then extend coverage with a second Airport -- or won't Airport connect me with my verizon.net email etc.?
    Actually that is a great question!
    The Verizon router is most likely a combination DSL modem and router or gateway device. The Express would still need a DSL modem in order for you to get Internet access from Verizon. You are probably better off just leaving the gateway in place and disabling its wireless radio so only the AirPorts provide the wireless network.

  • Why is the Output Panel in Bridge blank?

    When I select the Output Workspace in Bridge, the panel at the right is blank - no buttons, fields, or anything other than a monotonous dark gray surface. When I select the Output button and the Output to Web or PDF option, nothing happens.

    In edit/preferences/start up scripts do you have check marks for eveything?

  • Why does the new "share this page" button not stay deleted?

    Two issues with the latest two releases (35.0 and the one before)...
    1. The new "share this page" button (with the paper airplane icon) reappears everytime FF is started -- even though I have removed it from the toolbar. How can I make stay gone?
    2. The new info bar at the screen bottom "FF automatically sends some data..." is always present when FF starts -- even though I have completed the "choose what I share" Option. How do I permanently remove this?

    Separate Issue;
    Your System Details shows;
    Installed Plug-ins
    Shockwave Flash 16.0 r0
    Shockwave Flash 14.0 r0
    Adobe Shockwave for Director Netscape plug-in, version 12.1.5.155
    Adobe Shockwave for Director Netscape plug-in, version 12.1.4.154
    Having more than one version of a program may cause issues.
    Grab the uninstaller from here:
    '''[http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html Uninstall Flash Player | Windows]'''
    '''[http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html Uninstall Flash Player | Mac]'''
    Then reinstall the latest version.
    Flash Player '''v16.0.0.235 https://www.adobe.com/products/flashplayer/distribution3.html'''
    Shockwave Director '''v12.1.5.155 http://get.adobe.com/shockwave/'''
    '''https://support.mozilla.org/en-US/kb/how-to-fix-preferences-wont-save'''

  • TS1389 I paid for a year of Music Match but my iphone tells me I am not subscribed. I have the receipt and acknowledgment from Apple. Why is the iphone doing this?

    New to iPhone and thought Music Match sounded cool. Apple acknowledges my payment but the iPhone says I;m not subscribed. PRetty sure I'm suing the correct Apple I.D. and password. Any ideas out there?

    I have done that and it is definitely on.  My husband has the exact same phone and I upgraded his IOS at the same time, but this problem is not happening to his phone (we are also on the same plan, so our service should be the same).  Our settings appear to be identical and my phone is showing the 3G symbol at the top, so I can't understand why it won't access the network.
    I've turned it on and off twice and have reset all settings with my iTunes account, but it still isn't working.
    I'm not a complete idiot with this sort of stuff - I have tried all the obvious things.

  • Why does the Video do this?  Why is iMovie doing this all of a sudden

    http://www.esnips.com/doc/407a5579-501f-44a4-ad41-789684ea36ca/GIf-Remastered-Co medy-2
    WAtch it. near the beginning, the video just freezes and my vid has a lot more.
    Why is it doing this in imovie and how can I fix this?
    I used mov and mp4 and they bot h did this. I made 2 other videos last night and it didn't od this. This one did.
    I tried all thes tuff but it freezes in the video. I don't know why but it happens. how can I fix thi?

    Hi M
    That the Video freeses can have many origins. Most common is:
    - less than 5Gb free space on internal hard disk
    - use of external hard disk that is formatted FAT32 /DOS/UNIX/Mac OS Exchange
    should be: Mac OS Extended or Mac OS Extended (journaled)
    - other background processes running: Screen/Energy savers, photo as desktop
    backgroud - even worse if it changes every 5th second
    If You got > 25Gb free, no ext. hard disk and a clean desktop:
    Deleting iMovie pref file - should help
    iMovie
    -->/Users/YourName**/Library/Preferences/com.apple.iMovie.plist
    and
    -->/Users/YourName**/Library/Preferences/com.apple.iMovie3.plist
    AND I would also
    - Run: Repair permisions: Apple Disk Util tool (on hard disk/Applications/Tools/Disk Util tool
    and I would also
    - Run: Repair hard disk: Apple Disk Util tool - to do this You need to start from
    CD/DVD or external hard disk !
    Yours Bengt W

  • Why is the sound like this?

    Hi there.
    I have just finished one of my project, and now I notice, that when the person talks, starting at 1:05, the sound is not that good. Why is it? It sounds perfect on my computer when I play it. So what is wrong??
    http://vimeo.com/3682191

    Just look at the waveform...the peaks are badly clipped. Either the audio was recorded to hot or gain accidentally raised while editing. This should have been noticed in the Master Audio Meter while editing.

  • Why is the giving me this error (method does not return a value) PLEASE !!

    I have this code and it is giving me this error and I don't know how to fix it
    can anyone out there tell me why
    I have included the next line of code as I have had problems in the curly brackets in the past.
    The error is
    "Client.java": Error #: 466 : method does not return a value at line 941, column 3
    Please help
    THX TO ALL
    private Date DOBFormat()
        try
          if
            (MonthjComboBox.getSelectedItem().equals("") || 
             DayjComboBox.getSelectedItem().equals("") ||
             YearjComboBox.getSelectedItem().equals("")){
          else
            String dateString = StringFromDateFields();
            SimpleDateFormat df = new SimpleDateFormat("dd/mm/yyyy");
            Date d = df.parse(StringFromDateFields());
            System.out.println("date="+d);
            return d;
        catch (ParseException pe)
          String d= System.getProperty("line.separator");
          JOptionPane.showMessageDialog( this,
           "Date format needs to be DD/MM/YYYY,"+ d +
           "You have enterd: "+ StringFromDateFields()   + d +
           "Please change the Date", "Date Format Error",
           JOptionPane.WARNING_MESSAGE);
          return  null;
      //File | Exit action performed
    public void jMenuFileExit_actionPerformed(ActionEvent e) {
      System.exit(0);
      }

    Fixed it needed to have a return null;
    this is the code
    if
            (MonthjComboBox.getSelectedItem().equals("") ||
             DayjComboBox.getSelectedItem().equals("") ||
             YearjComboBox.getSelectedItem().equals("")){
            return null;

  • Plzz help me with the output of this code....

    hi all..
    plz check this code and tell me how to select one or more options from this Jlist and write the selected item into a text file....This code does that but the text file shows only one item (i tried using arry but din work) AND text file displays the item which is selected last time the code is interpreted..
    import java.awt.*;
    import java.io.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class mld extends JFrame implements ListSelectionListener, ActionListener
    {private JFrame    myframe = new JFrame("Select File");
                       private DefaultListModel listModel = new DefaultListModel();
         private JList list= new JList(listModel);
         private String selString = "select file name";
         private JButton selButton;
            public mld(){
         super("mld");
         addWindowListener(new WindowAdapter()
       {     public void windowClosing(WindowEvent ev) {dispose();     
                   System.exit(0);
              listModel.addElement("prog1");
    listModel.addElement("prog2");
         listModel.addElement("prog3");
         listModel.addElement("prog4");
         listModel.addElement("prog5");
         listModel.addElement("prog6");
         listModel.addElement("prog7");
         listModel.addElement("prog8");
         listModel.addElement("prog9");
         listModel.addElement("prog10");
         listModel.addElement("prog11");     
    listModel.addElement("prog12");
         list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    list.addListSelectionListener(this);
         JScrollPane listScrollPane = new JScrollPane(list);
         JButton selButton = new JButton(selString);
         selButton.setActionCommand(selString);
         selButton.addActionListener(this);
    //Create a panel that uses FlowLayout (the default).
         JPanel buttonPane = new JPanel();
         buttonPane.add(selButton);
         Container contentPane = getContentPane();
         contentPane.add(listScrollPane, BorderLayout.CENTER);
         contentPane.add(buttonPane, BorderLayout.SOUTH);
         pack();
         show();}
    public void valueChanged(ListSelectionEvent e) {}
    public void actionPerformed(ActionEvent e){
         String tmp = new String(list.getSelectedValue().toString());
    try{
    FileOutputStream fileOut = new FileOutputStream("temp.txt");
    fileOut.write(tmp.getBytes());
    fileOut.close();}
    catch (Exception e1)
    {                e1.printStackTrace();  }
    //*main method//
    public static void main(String s[]) {
         JFrame frame = new mld();
    try {
    Process p = Runtime.getRuntime().exec("notepad temp.txt ");
    p.waitFor();
    Process p1 = Runtime.getRuntime().exec("c:/Program Files/Microsoft Office/Office/outlook.EXE /c ipm.note /m [email protected] /a c:/temp.txt");
    catch(Exception e)
    {                e.printStackTrace();  }
    Thanx in advance
    bharthi

    replace
    FileOutputStream fs = new FileOutputStream("filename");
    with
    FileOutputStream fs = new FileOutputStream("filename",true);

  • Why is the output of rounding functions a double?

    I thought the whole idea of rounding was ending up with an integer?
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

    rolfk wrote:
    It returns whatever datatype you input in it. Makes a whole lot of sense as anything else would require allocation of a new data value in memory.
    Returning the same datatype sounds fine and dandy - until you think about it carefully (from the user experience side of it).  Why would you put anything but a fractional number into it?  So it's always going to return an approximation of an integer unless you actually plug an integer into it?  It just seems silly - strictly from a user standpoint - that you have to take one more step to get an actual integer.  To me, it's unexpected behavior, no matter how much sense it makes technically.  Again, though - all you have to do is coerce it to whatever you need it to be and only generate a new data value only when you have to.
    I feel a little like I'm X. right now. 
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • What will be the output of this simple programm ?

    Class ABC
    public static void main(String args[])
    long i = 22222222222222222;
    System.out.println(i);
    Pls give me how to get rid of this problem.
    (Casting to long also doesnot make any effect.)
    I think range of long is very big..although i donot know exactly but bigger than what i wrote.
    so why this problem occurs that "value out of range."
    waiting...
    J stands for Java ONLY

    Change Class to class, then do this:
    long i = 22222222222222222L;

  • Why is the output of the program "String S is null"

    public class StaticOverLoad
         public static void get(String S)
              System.out.println("String S is null");
         public static void get(Object O)
              System.out.println("Object O is null");
         public static void main(String args[])
              StaticOverLoad.get(null);
    }

    When the compiler tries to resolve an overloaded, it tries to get the most specific match. String is a subclass of object, so it is not specific. You can the call the other method by being explicit about your argument type.
    StaticOverLoad.get((Object) null);

Maybe you are looking for

  • How to call web service using J2SE 1.3?

    Dear All, i have developed a web service by jdev 10.1.3 (JAX-RPC with web service security enabled). i generate the ws proxy (jdev 10.1.3) and run it with wsclient_extended.jar (required JDK 1.4.1 or above??). but one of my client say he has to use J

  • Import Schema with error

    When i try to import a schema from one oracle to another one (also 11g), it shows the following errors: Job 999 has been reopened at Wednesday, 12 October, 2011 16:05 Restarting "SYS1"."999": Processing object type SCHEMA_EXPORT/USER ORA-39083: Objec

  • QuickTime and WMP

    Whenever I go to Tower Records to listen to samples of CD's the samples can be listened to with either RealPlayer or Windows Media Player. I click on the RealPlayer and no problem, everything plays fine. Whenever I click on the Windows Media Player s

  • Journal Entry DocEntry

    Hi Experts how to know the DocEntry of Journal Entry because when im uploading IP in DTW and the DocType is JE i was failed to upload because it say's "Base document card and target document card do not match. [RCT2DocLine][Line8] hope you can help m

  • How to set Debugging level FINEST in the different OS environment

    Hi All, Please help me out to get system logs with debugging mode set as FINEST. I want to know how to get system logs finest. Is there any xml configuration in root folder? Please help me out to get the logs for different environments like windows o