Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#736 import statement is misunderstood

open
nobody
7
2010-04-10
2009-03-09
Mathias Ricken
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

     
    Attachments
  • Mathias Ricken
    Mathias Ricken
    2010-04-10

    • priority: 5 --> 7