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

Issue with Launch Single-File Source-Code Programs : second top level class/application is run instead of first top level source file

XMLWordPrintable

    • x86_64
    • windows_7

      A DESCRIPTION OF THE PROBLEM :
      According to JEP 30 "https://openjdk.java.net/jeps/330

      "The source file should contain one or more top-level classes, the first of which is taken
      as the class to be executed."

      But the second top level class/application is run.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Some error message.
      ACTUAL -
      Hello John

      ---------- BEGIN SOURCE ----------
      package java11;
       

      public class Hello2{
      public void hello(String name){
      System.out.println("Hello "+name);
      }
      }



      public class Hello {

      public static void main(String[] argv){
       Hello hello=new Hello();

       hello.hello(argv[0]);
        

      }
      public void hello(String name){
      System.out.println("Hello "+name);
      }

       
      }
      ---------- END SOURCE ----------

            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: