Код: Выделить всё
import java.io.FileNotFoundException;
import java.util.Scanner;
public class HangmanProject
{
public static void main(String[] args) throws FileNotFoundException
{
public static void getFile() {
getFile gf() = new getFile();
Scanner test = gf.wordScan;
}
}
Код: Выделить всё
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Scanner;
public class getFile
{
String wordList[] = new String[10]; // array to store all of the words
int x = 0;
Scanner keyboard = new Scanner(System.in); // to read user's input
System.out.println("Welcome to Hangman Project!");
// Create a scanner to read the secret words file
Scanner wordScan = null;
try {
wordScan = new Scanner(new BufferedReader(new FileReader("words.txt")));
while (wordScan.hasNext()) {
wordList[x] = wordScan.next();
System.out.println(wordList[x]);
x++;
}
}
finally {
if (wordScan != null)
{
wordScan.close();
}
}
}
- где мой конструктор,
- правильно ли я его использую,
- нужно ли изменить раскладку?
Подробнее здесь: https://stackoverflow.com/questions/121 ... or-in-java
Мобильная версия