FirstAndLast - word=s; } public void findFirstLastLetters()...

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

View Full Document Right Arrow Icon
//© A+ Computer Science - www.apluscompsci.com //Name - //Date - //Lab - import static java.lang.System.*; public class FirstAndLast { private String word; private char firstLetter; private char lastLetter; public FirstAndLast() { setString(""); word=""; } public FirstAndLast(String s) { setString(s); } public void setString(String s) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: word=s; } public void findFirstLastLetters() { firstLetter=word.charAt(0); lastLetter=word.charAt(word.length()-1); } public String toString() { String output=""; output+="word :: "+word+"\n"; output+="firstLetter :: "+firstLetter+"\n"; output+="lastLetter :: "+lastLetter+"\n"; return output; } }...
View Full Document

This note was uploaded on 11/11/2011 for the course C++ comp122 taught by Professor N/a during the Spring '07 term at Cy-Fair College.

Ask a homework question - tutors are online