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

compiler accepts (Integer).toString(123)

XMLWordPrintable

    • merlin
    • generic
    • generic
    • Verified



      Name: pa48320 Date: 11/21/2000

      I came across this in some code someone else
      wrote. It compiles with the J2SDK 1.3 javac.exe compiler
      but not with some other compilers (such as jikes)
      and I think it is illegal Java syntax, as per
      my interpretation of the JLS.

      public class CastOrStaticMethod
      {
        public static void main(String argv[])
        {
          System.out.println( (Integer).toString(123) );
        }
      }

      This should of course be Integer.toString(123)
      but javac accepts it.

      ======================================================================

            gafter Neal Gafter (Inactive)
            pallenba Peter Allenbach (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: