-1

I just installed java and am trying to compile sample code. I copied a Fibonacci sequence program into Notepad, saved it as "Fibonacci.java" and compiled it in Windows command prompt as such:

javac Fibonacci.java

The output: MyFirstApp.class

MyFirstApp is the name for another thing I'm working on in Eclipse. What's going on?

THanks for help.

Code:

public class Fibonacci {

   public static void main(String[] args) { 
      int N = Integer.parseInt(args[0]);
      int f = 0, g = 1;

      for (int i = 1; i <= N; i++) {
      f = f + g;
      g = f - g;
       System.out.println(f); 
      }
   }
}
Fluxcapacitor
  • 393
  • 2
  • 4
  • 14
  • Is the name of the class in Fibonacci.java `Fibanacci`? Also, are you sure you are looking for the resulting class file in the right place? – Sotirios Delimanolis Mar 23 '13 at 00:57
  • have a look at this [question](http://stackoverflow.com/questions/2134784/why-filename-in-java-should-be-same-as-class-name) – A4L Mar 23 '13 at 01:03
  • Fibonacci is spelled correctly, and I am not sure I am looking for the file in the right place. I have no clue what is going on w/all the directories among Java, Eclipse and the OUYA-ODK I'm trying to learn. – Fluxcapacitor Mar 23 '13 at 01:24
  • Be sure Eclipse is compiling what you think it's compiling. – Makoto Mar 23 '13 at 01:29
  • @Fluxcapacitor - At the command prom, before invoking Java compiler try `DIR *.java` and see whether the source code you're trying to compile is indeed in this directory. – PM 77-1 Mar 23 '13 at 02:19

1 Answers1

0

please send us the source code.

Could be as simple as you forgot to change in the sourcecode from

class MyFirstApp { ....

To

class Fibonacci { ...

???

And your class file is an old output file from earlier compilation?

MrSimpleMind
  • 7,890
  • 3
  • 40
  • 45
  • 2
    This is not an answer, it should have been a comment. – madth3 Mar 23 '13 at 01:08
  • Sotirios, did you see my write a PUBLIC class? No! The code I wrote is 100% free from errors. Compilation error would thrown if the class was addressed as public and the filename is not matched. I think my answer is the closest to the question, but I see now that the sourceode he just gave is a public class Fibon.... But he might have changed the code. Can thread owner please tell the status of this error. – MrSimpleMind Mar 23 '13 at 16:57