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

Case Sensitivity Issue in Compiling Classes Named Sample and sample

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      When compiling a Java file containing multiple classes, including `Sample` and `sample`, only one of the compiled files is generated (e.g., `Sample.class`). The expected behavior is that both `Sample.class` and `sample.class` should be generated, as Java is case-sensitive.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a Java file with the following content:
         ```java
         class Sample {
             public static void main(String[] args) {
                 System.out.println("Hello World");
             }
         }
         class sample {
             public static void main(String[] args) {
                 System.out.println("Hello World");
             }
         }```
      2. Compile the file using javac Filename.java.
      3. Check the generated .class files

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Files with name Sample.class and sample.class should be present.
      ACTUAL -
      only one file is present.

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: