This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

chi Lin

Ranch Hand
+ Follow
since Aug 24, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by chi Lin

For that you need a way to pad the output, cattleDrive provide a method there, change " " to "0".

Originally posted by Sultan A. A:
Thanks for help, but the problem now is the output like this
1 10 11 100 101 110 111
I want it like
001 010 011 100 101 110 111

and
thaks for help me again,


[ October 01, 2004: Message edited by: chi Lin ]
15 years ago
try


[ September 28, 2004: Message edited by: chi Lin ]
15 years ago


it should be
15 years ago
use the ? : operator.
[ June 26, 2004: Message edited by: chi Lin ]
15 years ago
Rob,

As Tim mentioned if you want to use Integer.parseInt(), you
have to handle the exception otherwise the program may terminated
ugly with some annoying exception message when user enter non-parsable string.

Originally posted by Tim West:
....
If you want to use parseInt() to implement isInteger(), you'll have to catch the exception.
....

15 years ago
first thing come to my mind is :

looping through the String s, for each
character ues Character.isDigit() to check.

Also pay attention to the possible positive/negative sign
at the beginning of the String s, as +/- are not digits
but could be part of valid integer.
[ June 14, 2004: Message edited by: chi Lin ]
15 years ago


...
user just inputs something and it gets printed out again
...



Things got complicated because you are not just got
anything from user then output it.

With System.out.print("Enter a number: ");
You are asking user to enter a number, then Integer.parseInt(input)
convert the input from String to integer.

Problem is user may not always follow the instruction and might enter something that is NOT parsable to integer.

To check this, the code was wrapped into try-catch block for possible Exception.
[ June 13, 2004: Message edited by: chi Lin ]
15 years ago
Hi,

I am palying with JFileChooser, I put out some code and it does shows
a openDialog box when run.

Problem is the program does NOT terminate after I choose a file & click OK.
(I did not see the promt appear)

Please advise if I did something wrong ?


[ June 11, 2004: Message edited by: chi Lin ]
15 years ago
First follow Ernest's advice by adding

import java.io.*;

you should see some difference.
15 years ago
1. usel Calendar.getInstance() to get a Calendar object.
2. call set(year, month, data) to set the date you need
3. call get(Calendar.DAY_OF_WEEK) to get the day, it return a number between
1 - 7 (Sunday - Saturday).

HTH
15 years ago
You need Collections.shuffle(Arrays.asList(cards);
15 years ago