Sunteți pe pagina 1din 1

/*

*
* Author: J Sun
* 10/7/07
*/

import java.util.Scanner;

public class StarMethod


{
public static void main(String[] args)
{
Scanner scan = new Scanner (System.in); //imports scanner
String user = ""; //userinput
int indexOf = 0; //the number for the index
of stars
String yesNo = ""; //true or false value

System.out.println("Enter something."); //asks user for input


user = scan.nextLine(); //scans info

if (user.length()<0||user.indexOf('*')<0) //if a string does not


have any info and no star
yesNo = "false"; //returns false
else if (user.length()>0&&user.indexOf('*')>0)//if it does
yesNo = "true"; //returns true

System.out.println(yesNo); //output.

} //psvm
} //pcSM

S-ar putea să vă placă și