• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 773
  • Last Modified:

Using DecimalFormat

I'm attempting to use an object of the DecimalFormat class. However, I'm continually receiving the following when I attempt to compile:

"cannot resolve symbol class DecimalFormat"

for the lines where I create a new DecimalFormat object. My code is as such:
public class DecimalFormatDemo
      public static void main(String[] args)
            DecimalFormat twoDigitsPastPoint = new DecimalFormat("0.00");
            DecimalFormat threeDigitsPastPoint = new DecimalFormat("00.000");
            double d = 12.3456789;


Any ideas what I'm doing wrong??
  • 2
1 Solution
did you import

import java.text.NumberFormat;
Tommy BraasCommented:
make sure you have the following line before your class declaration:
import java.text.DecimalFormat ;
Tommy BraasCommented:
Excuse me
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now