- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DecimalFormat(abc#) in Java
DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.
Let us set DecimalFormat(abc#) first −
Format f = new DecimalFormat("'abc'#");
Now, we will format a number and display the result in a string using the format() method −
String res = f.format(-3968.7878);
Since, we have used both Format and DecimalFormat class in Java, therefore importing the following packages in a must −
import java.text.DecimalFormat; import java.text.Format;
The following the complete example −
Example
import java.text.DecimalFormat; import java.text.Format; public class Demo { public static void main(String[] argv) throws Exception { Format f = new DecimalFormat("'abc'#"); String res = f.format(-3968.7878); System.out.println(res); } }
Output
-abc3969
- Related Articles
- DecimalFormat("000000E0") in Java
- DecimalFormat("00.00E0") in Java
- DecimalFormat("##E0") in Java
- DecimalFormat("###E0") in Java
- DecimalFormat("00E00") in Java
- DecimalFormat("000E00") in Java
- DecimalFormat("0000000000E0") in Java
- DecimalFormat("0.######E0") in Java
- Format double with new DecimalFormat("0.#####E0") in Java
- Find $angle ABC=?$"
- Abstract Base Classes in Python (abc)
- ∆ABC ~ ∆LMN. In ∆ABC, AB = 5.5 cm, BC = 6 cm, CA = 4.5 cm. Construct ∆ABC and ∆LMN such that $frac{BC}{MN} = frac{5}{4}$.
- If $angle ABC= 65^{circ}$. Measure the supplementary angle of $angle ABC$.
- ( mathrm{ABC} ) is a triangle. Locate a point in the interior of ( triangle mathrm{ABC} ) which is equidistant from all the vertices of ( triangle mathrm{ABC} ).
- In the figure, $ABC$ and $ABD$ are two triangles on the base $AB$. If line segment $CD$ is bisected by $AB$ at $O$, show that $ar(triangle ABC) = ar(triangle ABC)$."

Advertisements