fork download
  1. public class Ideone {
  2.  
  3. static long fibo(int n) {
  4. if (n < 2) {
  5. return n;
  6. } else {
  7. return fibo(n - 1) + fibo(n - 2);
  8. }
  9. }
  10.  
  11. public static void main(String[] args) {
  12.  
  13. // teste do programa. Imprime os 30 primeiros termos
  14. for (int i = 0; i < 30; i++) {
  15. System.out.print("(" + i + "):" + Ideone.fibo(i) + "\t");
  16. }
  17.  
  18. }
  19.  
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class Ideone is public, should be declared in a file named Ideone.java
public class Ideone {
       ^
1 error
stdout
Standard output is empty