Cshah
Posts: 16
Nickname: tkc204
Registered: Oct, 2002
|
|
i include string.
|
Posted: Oct 7, 2002 10:33 PM
|
|
|
Advertisement
|
this is wat my code looks like:
import javax.swing.*;
public class hwk3 { public static void main( String[] args ) { String name; name = JOptionPane.showInputDialog( "Enter one word" ); int numChar=name.length();
// print letter
System.out.println( "The number of Characters is: " + numChar + "," ); isHyphenated(name);
System.exit( 0 );
} public static void isHyphenated(String word) { int index=0; while( index < word.length()) { if(charAt(index) == '-')
System.out.println("There is a hyphen at position:" + index); index = index + 1; } }
|
|