Results 1 to 6 of 6
Thread: "Cannot find symbol" error
- 09-27-2011, 01:33 PM #1
Member
- Join Date
- Sep 2011
- Location
- Sale, Cheshire
- Posts
- 10
- Rep Power
- 0
"Cannot find symbol" error
Hi, Hope someone can offer help on this. I get the "Cannot find symbol" error when trying to compile the code below. I cannot see what the problem is, if anyone can help I would really appreciate it.
import java.util.*;
import java.text.*;
public class NumberFormat {
public static void main(String[] args) {
float f1 = 456.789f;
Locale locSP = new Locale("es"); // SPAIN
NumberFormat[] nfa = new NumberFormat[4];
nfa[0] = NumberFormat.getInstance();
nfa[1] = NumberFormat.getInstance(locSP);
nfa[2] = NumberFormat.getCurrencyInstance();
nfa[3] = NumberFormat.getCurrencyInstance(locSP);
for(NumberFormat nf : nfa)
System.out.println(nf.format(f1)); }} Thanks MBD.
- 09-27-2011, 01:47 PM #2
Member
- Join Date
- Sep 2011
- Posts
- 5
- Rep Power
- 0
Re: "Cannot find symbol" error
Hi,
Change the class name as NumberFormat1 and save the file name as NumberFormat1.java.
We have to differentiate user defined class and in built class.
- 09-27-2011, 02:08 PM #3
Member
- Join Date
- Aug 2011
- Posts
- 16
- Rep Power
- 0
Re: "Cannot find symbol" error
yes exactly try changing the class name. it should work,
- 09-27-2011, 02:29 PM #4
Member
- Join Date
- Sep 2011
- Location
- Sale, Cheshire
- Posts
- 10
- Rep Power
- 0
Re: "Cannot find symbol" error
Thanks for replies, although changing the class name still gives the same error.
- 09-27-2011, 02:34 PM #5
Member
- Join Date
- Sep 2011
- Posts
- 5
- Rep Power
- 0
Re: "Cannot find symbol" error
Please remove the file NumberFormat.java from your working directory and compile the code with new file. It gives the solution.
- 09-27-2011, 02:41 PM #6
Member
- Join Date
- Sep 2011
- Location
- Sale, Cheshire
- Posts
- 10
- Rep Power
- 0
Similar Threads
-
"cannot find symbol" error
By droidus in forum New To JavaReplies: 2Last Post: 09-07-2011, 07:43 AM -
Do you know why I'm getting "cannot find symbol" error?
By basla in forum New To JavaReplies: 5Last Post: 04-24-2011, 03:21 PM -
"Cannot find symbol" errors in Java
By 23Zone in forum New To JavaReplies: 1Last Post: 02-17-2010, 07:13 AM -
Error "can not find symbol variable"
By FullMetalHollow in forum New To JavaReplies: 5Last Post: 10-04-2009, 09:51 PM -
"Cannont find symbol Constructor" error
By Welsh in forum New To JavaReplies: 7Last Post: 01-25-2008, 12:12 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks