• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

This was a program given as an assignment

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
write a java program that should change the case of every second character to the upper case and print them
for instance:input:hello world
output should be:hElLo WoRlD
please give the code
 
Rancher
Posts: 43081
77
  • Likes 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you want us to do your assignment for you? Will we get the credit for it as well? Or were you thinking of paying us?
 
kiruthigha rajan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:So you want us to do your assignment for you? Will we get the credit for it as well? Or were you thinking of paying us?


excuse me.. it was not assigned for me..i saw this on a book..i tried out of curiosity.. i couldnt get..i just asked help so that i can learn.. [DELETED]
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

kiruthigha rajan wrote:write a java program that should change the case of every second character to the upper case and print them
for instance:input:hello world
output should be:hElLo WoRlD
please give the code




FYI... the example shown doesn't capitalize every second character. For the second word, it capitalize everything but the second letter. Never mind. I see now. It is capitalizing every other letter -- and not the second letter of each word.

Also, IMO, this is something that can be simply done via a regular expression. It can still easily be done via regular expressions, but definitely more awkward.

Henry
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic