What's wrong with my java code? (parsing error)

tonyabracadabra
public class 1127 
{
    public static void main(String[] args)
    {
        binomial();
    }

    public static double binomial(int N, int k, double p)
    {
        if (N == 0 && k ==0) return 1.0;
        if (N < 0 || k < 0) return 0.0;
        return (1.0 - p)*binomial(N-1, k, p) + p*binomial(N-1, k-1, p);
    }
}

/Volumes/2/Learn_Algorithms/chapter one/1127.java:13: reached end of file while parsing }}
SUBNULNULNULNULNULNULNULNULNUL

^ 15 Errors

This is my first time writing Java code and I have a few questions.

  1. what does the "reached end of file while parsing" mean?

I don't think I missed any '{' or '}'

  1. Then how about those series of SUBNULNULNUL...?

  2. How did it calculate out 15 ERRORS?

Jesper

The name 1127 is not a valid name for a class.

A class name is an identifier and must start with a letter; identifiers cannot start with a digit.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related