Hi,
The following code compiles and runs fine from the hard drive but does not compile fine from a floppy disk. It gives me a cannot resolve symbol error for the DataSet dataSet = new DataSet(); line. Any ideas? The program is supposed to except user input for 4 integers and display the smallest and the largest of the 4. It does that fine from the hard drive.

class DataSet3
{
        private int smallest;
        private int largest;
        private int value1;
        private int value2;
        private int value3;
        private int value4;

        //The constructor

        public DataSet3()
        {
            smallest = 0;
            largest = 0;
        }

        public void addValue(int whatvalue1, int whatvalue2, int whatvalue3, int whatvalue4)
        {
            value1 = whatvalue1;
            value2 = whatvalue2;
            value3 = whatvalue3;
            value4 = whatvalue4;    
        }

        public int getSmallest()
        {
        int min12 = Math.min(value1, value2);
        int min34 = Math.min(value3, value4);

            return Math.min(min12, min34);
        }

        public int getLargest()
        {
        int max12 = Math.max(value1, value2);
        int max34 = Math.max(value3, value4);

            return Math.max(max12, max34);

        }
}


import javax.swing.JOptionPane;

class DataSetTest3
{
    public static void main(String[] args)
    {

        int number1 = 0, number2 = 0, number3 = 0, number4 = 0;
        String value=" "; 

        value = JOptionPane.showInputDialog("Please Enter Number 1:"); 
        number1 = Integer.parseInt(value); 

        value = JOptionPane.showInputDialog("Please Enter Number 2:"); 
        number2 = Integer.parseInt(value); 

        value = JOptionPane.showInputDialog("Please Enter Number 3:"); 
        number3 = Integer.parseInt(value); 

        value = JOptionPane.showInputDialog("Please Enter Number 4:"); 
        number4 = Integer.parseInt(value); 

        DataSet dataSet = new DataSet();
        dataSet.addValue(1, number1);
        dataSet.addValue(2, number2);
        dataSet.addValue(3, number3);
        dataSet.addValue(4, number4);

        System.out.println("The smallest number is " +dataSet.getSmallest());
        System.out.println("The largest number is  " +dataSet.getLargest());

        System.exit(0);

    }
}

Dani AI

Generated

The compiler error saying the symbol for the referenced type cannot be resolved means the Java compiler never sees a definition named exactly that way in the current compilation set or classpath. flagged the missing type and pointed to a naming mismatch; below are concrete, floppy-specific diagnostics and fixes that go beyond those observations.

  • Confirm the actual files on the floppy and their extensions (Windows often hides “.txt”). Use a directory listing to verify names and sizes:
dir
ls -l
  • Compile all related sources together so the compiler can resolve referenced types:
javac *.java

or list the files explicitly.

  • Verify the declared class name inside the source exactly matches the filename (including letter case) and that there is no stray Unicode BOM or invisible character at the top of the file. Editors that add a hidden extension or BOM will break javac’s ability to find the class.

  • Check for platform and filesystem quirks: name truncation on very old FAT formats, case-sensitivity differences if the floppy is used across OSes, and accidental package declarations that require a matching folder structure.

  • Check for incomplete or corrupted copies: low space, write-protect switch, read errors, or failed copy operations can produce truncated files. Compare sizes or checksums between the working hard-drive copy and the floppy copy to confirm integrity.

Practical workarounds: compile on the hard drive and copy the resulting .class files to the floppy, or bundle sources/classes into a JAR. For long-term reliability, avoid using floppies for development files; they are error-prone and small, which makes transient file corruption and partial writes common failure modes.

Recommended Answers

All 2 Replies

Where is your Dataset() method defined? Are you including this class on your floppy? I ask because I don't see it (Dataset) defined, or included in your code above.

I assume you are compiling on a different PC?

It looks like you renamed the class. Either change all references to DataSet to DataSet3 -OR- change all DataSet3 to DataSet

//Make it like this:
class DataSet
{
     	public DataSet()
        .....

}

class DataSet3
{
public DataSet3()
.....

}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.