Menu

#736 import statement is misunderstood

open
nobody
7
2010-04-10
2009-03-09
No

The import statement in this listing is somehow misunderstood.

import java.math.BigInteger;
class Fact {
static BigInteger fact(BigInteger n) {
if (n.equals.BigInteger.ZERO) return BigInteger.ONE;
return fact(n.subtract(BigInteger.ONE)).multiply(n);
}
}

It generates the errors (and more):

11 errors found:
File: D:\Desktop\Fact.dj2 [line: 1]
Error: The class java.math.BigInteger is not in the right package. Perhaps you meant to package it?
File: D:\Desktop\Fact.dj2 [line: 1]
Error: java.math.BigInteger is not public, and thus cannot be seen here

Changing the import statement to

import java.math.*;

works.

Discussion

  • Mathias Ricken

    Mathias Ricken - 2009-03-09

    Sample file

     
  • Mathias Ricken

    Mathias Ricken - 2010-04-10
    • priority: 5 --> 7
     

Log in to post a comment.