[問題] Java新手請教
剛開始學java
很多都還一支半解
想請教各位大大
======================================================================
import java.util.*;
import java.util.Scanner;
public class Prac2
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
do
{
String guess;
int wL=0;
char hidden='r';
char gchar;
System.out.println("enter your word, stop to end.");
guess = sc.nextLine();
wL = guess.length();
while(guess != 'stop')
{
for(int i=0;i<wL;i++)
{
gchar=guess.charAt(i);
if(gchar = hidden)
{
System.out.println("Your guess does not contain the secret letter");
System.out.println("enter next word, stop to end.");
guess = sc.nextLine()
}
else
{
System.out.println("Your guess contains the secret letter");
System.out.println("enter next word, stop to end.");
guess = sc.nextLin()
}
}
}
}
}
}
==============================================================
這個程式有什麼問題
要怎麼修改呢?
我試了好久> <
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 121.223.160.59
推
09/13 16:05, , 1F
09/13 16:05, 1F
→
09/13 16:13, , 2F
09/13 16:13, 2F
→
09/13 16:15, , 3F
09/13 16:15, 3F
推
09/13 16:36, , 4F
09/13 16:36, 4F
→
09/13 17:05, , 5F
09/13 17:05, 5F
推
09/13 17:24, , 6F
09/13 17:24, 6F
→
09/13 17:42, , 7F
09/13 17:42, 7F
推
09/20 13:13, , 8F
09/20 13:13, 8F