Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8265629

Handling of special characters with Integer datatype

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10

      A DESCRIPTION OF THE PROBLEM :
      Compile time error not handled when "_" special character is used with Integer datatype


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a class
      Create the main method
      Print 7_7 without double quotes just as the integer
      Use if conditional statement to check if(77==7_7) and inside it print "Equal"
      Use Else statement to check if it is not and inside it print "Not Equal"
      Unexpectedly it prints 77 and and from if condition prints "true"






      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compile Time Error
      ACTUAL -
      It prints 77 and is goes to If condition when executed with above STR prints Equal

      ---------- BEGIN SOURCE ----------
      public class Oracle_Issue {

      public static void main(String[] args) {

      System.out.println(7_7);
      if(77 == 7_7) {
      System.out.println("Equal");
      }
      else {
      System.out.println("Not Equal");
      }
      }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

        1. Check.java
          0.2 kB
          Muralidhar Indraganti
        2. Oracle_Issue.java
          0.2 kB
          Muralidhar Indraganti

          Activity

            People

            Assignee:
            darcy Joe Darcy
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: