| Andrew Thompson 2005-08-19, 4:20 pm |
| On Fri, 19 Aug 2005 12:09:12 GMT, Jason S via JavaKB.com wrote:
> Q1 : How to use import java.text.* to control the number of digit after
> decimal?
Are you asking how to import classes, or how to use
the classes of the java.text package to produce the
result?
It sounds as though your assignment asked you to format
the numbers and to look into the java.text package.
They probably want you to use either..
<http://java.sun.com/j2se/1.4.2/docs...mberFormat.html>
...or..
<http://java.sun.com/j2se/1.4.2/docs...imalFormat.html>
Though you should have a look at the Javadocs and see if you
can figure that out for yourself.
> Q2 : I want to control the number enter by user in between 0 to 1000, then i
> type tis 0=<num<=1000;
No you didn't! That would produce something like..
F:\Blah.java:nn: illegal start of expression
0=<num<=1000;
^
1 error
You probably typed
0<=num<=1000;
Please always copy/paste code samples and errors
<http://www.physci.org/codes/javafaq.jsp#exact>
> but come out command tat tis is not a statement.
Yes. What makes you think that *is* a valid Java statement?
Do you have Java books and have you been reading them?
For checking those Java errors an what they mean, you might
try looking on this page..
<http://mindprod.com/jgloss/compilee...ages.html#INDEX>
>..May i know wats wrong and how should i do.
The statement you are after seems to be 'if'.
// this will not compile..
if (0<=num<=1000) {
F:\Blah.java:nn: operator <= cannot be applied to boolean,int
if (0<=num<=1000) {
^
// this should compile..
if (0<=num && num<=1000) {
System.out.println("In RANGE!");
}
if (0<=num && num<=1000) {
....
means..
if
(true)
and
(true)
do
....
Hope That Helps
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"A simple prop to occupy my time.."
R.E.M. 'The One I Love'
|