Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

BigInteger error  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am getting error in this code :



Error is :


G:\Java>javac Main1.java
Main1.java:9: error: cannot find symbol
ArrayList<BigInteger> array = new ArrayList<BigInteger>();
^
symbol: class BigInteger
location: class Main1
Main1.java:9: error: cannot find symbol
ArrayList<BigInteger> array = new ArrayList<BigInteger>();
^
symbol: class BigInteger
location: class Main1
2 errors



Could not understand why I am getting it ? BigInteger is in lang package , so no need to import it .
 
Marshal
Posts: 4349
280
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You sure about that? Last time I checked it lived in java.math.
 
Marshal
Posts: 58315
178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you are thinking of Integer which is in the java.lang package.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BigInteger class is available in java.math package. so you need to import that class in order to use it. try compiling below code

 
Marshal
Posts: 5589
383
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sankalp Bhagat wrote:try compiling below code

If decent Java version is used, on line 5 second time explicitly specify the type argument is not needed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!