Uploaded image for project: 'BlueJ'
  1. BlueJ
  2. BLUEJ-1319

Result not valid var name for codepad

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Highest
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 5.0.0
    • Component/s: CodePad

      Description

      There is an anomalous behaviour of the codepad when you define any variable or any type named "result" (obviously without ""). In this case all the variables defined of the same type appears to be valued to 0. (I think internally it contains the right values, but, if you want to show the content in the codepad the answer is 0, 0.0 or null)

      Try this sequence in the codepad:
      --------------------------
      int x = 8;
      int y = 2;
      x
      8 (int)
      y
      2 (int)
      int result = x + y;
      result
      0 (int)
      x
      0 (int)
      y
      0 (int)
      ---------------------------
      after this point any new int variable will be shown with a 0 (int) value.
      Same happens by using double variables instead int, or a reference like String (null instead 0)

      Surprisingly, if you try to print the variable x or y through the terminal (System.out.println the right value is shown, but if you try to do it with "result" variable the value of x is shown instead x + y

        Attachments

          Activity

            People

            • Assignee:
              pwt Pierre Weill-Tessier
              Reporter:
              babis Charalampos Kyfonidis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: