convertion method?

F

fusion

hi friends,

last night i was doing a programmes from one ebook,i look at one
programme that look very easy at first look and i created but then i
realize its bit of diffrent than i thought, here is the program.

"Write a Program that takes any no. of strings as command line argument
and print that string and its length in characters."

at first i created the program which outputs that string and its
length,but only problem was it prints length in no.whereas program
requires output in characters.i have search allmost every java book
that i have but i was unable to find any mathod or anything like this
so friends if anyone knows any technique or mathod then please reply
me.
 
I

Ingo R. Homann

Hi,
hi friends,

last night i was doing a programmes from one ebook,i look at one
programme that look very easy at first look and i created but then i
realize its bit of diffrent than i thought, here is the program.

"Write a Program that takes any no. of strings as command line argument
and print that string and its length in characters."

at first i created the program which outputs that string and its
length,but only problem was it prints length in no.whereas program
requires output in characters.i have search allmost every java book
that i have but i was unable to find any mathod or anything like this
so friends if anyone knows any technique or mathod then please reply
me.

Do you mean the diffenece between String.length and
String.getBytes().length or what do you mean?

Perhaps you can post your code...

Ciao,
Ingo
 
C

Chris Uppal

fusion said:
"Write a Program that takes any no. of strings as command line argument
and print that string and its length in characters."

at first i created the program which outputs that string and its
length,but only problem was it prints length in no.whereas program
requires output in characters.

I think the book means

print that string, and the length (in characters) of the string.

I.e. it's telling you what it means by "length" (the number of characters)
rather than telling you that you have to print out the result in a strange way.
So you've already solved the problem :)

Of course, if you want to solve the other problem /anyway/

cat three
elephant eight

then that's more difficult, and -- as you've found -- there is no standard
method. It's probably a bit beyond you so far, but if you want to try it then
you'll need to use arrays of fixed strings (don't worry if you don't know what
that means yet).

-- chris
 
R

Roedy Green

at first i created the program which outputs that string and its
length,but only problem was it prints length in no.whereas program
requires output in characters.i have search allmost every java book
that i have but i was unable to find any mathod or anything like this
so friends if anyone knows any technique or mathod then please reply
me.

That sounds like something King Of the Hill's Boomhauer might say. Try
posting your code. It will explain your problem more eloquently.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top