How to Spell a Number in Java
Although the Java programming language supports a full array of Integer and Float-type variables that are truly numeric, you can still spell a number in Java using a text-based string. Once this number has been spelled out, you can use it in any number of text applications, such as printing a label in a Swing or AWT interface component.
Instructions
-
-
1
Open your Java file in your preferred text editor or Integrated Development Environment.
-
2
Scroll to the point in your code where you'd like to insert the text-based number, such as a ListBox component in an AWT file.
-
-
3
Type the following text, without quotation marks:
"String <name> = "Number Text";
-
4
Replace "<name>" with the name of the variable you'd like to create and "Number Text" with the text-based version of the number, such as "Seven."
-
1