Alright i am writing a program to read a sentence you write and judging by you punctuation it will tell you whether its a statement, question, exclamation or other. My problem is that it isnt running my If statement. am i just bind and missing something.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication17;
import java.util.*;
/**
*
* @author Austin Skarphol
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
char Find[]={'.','!','?'};
String find = new String(Find);
System.out.println("Please type a sentence with correct punctuation. >");
String Word = scan.next();
if (Word.indexOf(find) != -1)
System.out.println("this is a statment");
else if (Word.indexOf(find)!= -1)
System.out.println("This is an exclamation");
else if (Word.indexOf(find)!= -1)
System.out.println("This is a question");
}
}