This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

symbol not found?  RSS feed

 
ian myers
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to compile this code




but whenever i do i get

Decimals.java:3: missing method body, or declare abstract
public static void main (String[]args);
^
Decimals.java:9: cannot find symbol
symbol : class getCurrencyInstance
location: class java.text.NumberFormat
java.text.NumberFormat nf = new java.text.NumberFormat.getCurrencyInstance();
^
2 errors


Anyone have any suggestions?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

1) The ";" at the end of the "main" line doesn't belong there

2) You don't write "new java.text.NumberFormat.getCurrencyInstance()" -- you just call the method getCurrenctInstance() to get the object you want:



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: carefully inspect line 3. What's amiss?
 
ian myers
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
haha i got it thanks guys
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!