• Post Reply Bookmark Topic Watch Topic
  • New Topic

need some advise.  RSS feed

 
Tontang Bei
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I was writing this code today with header info as follows
import java.util.Scanner;
import java.text.*;
import java.util.Locale.*; <- I made a mistake here

I was supposed to do import java.util.Locale; instead, So I wasted alot of time trying to figure out how to get this to work.
The error I kept getting was on the method below I was using somewhere in the code:
NumberFormat nf = NumberFormat .getCurrencyInstance (Locale.US);

error: Cannot find symbol variable locale.

I nearly lost my balance because of this. I thought if the Api had just shown how to import the damm thing it couldve been avoided. What sites do you guys refer to when in such a situation
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would generally 'GOOGLE' the error. If it is a common error you will get your solution and that is the case most of the times.
 
Chuck Lowry
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using an IDE will save you lots of time and frustration. Most IDE's would have pointed out your problem immediately. I would suggest using Eclipse since it is both a relatively mature product and it is free.
 
Anton Uwe
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tontang Bei

Please note that with "import java.util.Scanner;" you import the class Scanner and with "import java.text.*;" you import all classes of the package "java.text".
[ January 31, 2007: Message edited by: Anton Uwe ]
 
Pablo M�ller
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using ecplise, SHIFT+CTRL+O will fix the import problems, and ask you to decide when it finds different optios.
Good luck!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!