Capitalize

Capitalize - //String part2 = word.substring(1,...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Capitalize { public static void main(String[] args) { System.out.println("Enter a word: "); String word = IO.readString(); //if (word.length() == 0) if (word.equals("")) { IO.reportBadInput(); return; } String part1 = word.substring(0,1); String part2 = word.substring(1);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //String part2 = word.substring(1, word.length()); part1 = part1.toUpperCase(); part2 = part2.toLowerCase(); word = part1.concat(part2); //word = part1 + part2; IO.outputStringAnswer(word); } }...
View Full Document

This note was uploaded on 11/03/2009 for the course CS 01-111 taught by Professor Pradiphari during the Fall '09 term at Rutgers.

Ask a homework question - tutors are online