Hello everyone, first off, I wish to state that I am new to these forums. With that said, if the problem I am about to pose could have been handled in a different section, I do apologize, for I tired to find an appropriate place to pose the issue. Having that out of the way, allow me to me to give everyone a back story.
To start, the project I am doing is for a class, where I am to enter several inputs(Strings) and have them printed out with a ".txt" extension. Here's my code for visualization:
package ticket;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
import java.util.logging.Logger;
import java.util.logging.Level;
/**
*
* @author neilganti
*/
public class FileTicketAsText {
private static String file;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner scan = new Scanner(System.in);
String name = getName(scan, " Name");
String symbol = getSymbol(scan, " Symbol ");
String title = getTitle(scan, "Title");
String summary = getSummary(scan, " Summary ");
String question = getQuestion(scan, " Question");
String answer = getAnswer(scan, " Answer");
String nameFile = file + "txt";
FileWriter outputStream = null;
String word = null;
try {
outputStream = new FileWriter(nameFile);
BufferedWriter out = new BufferedWriter(outputStream);
out.write(word + "/n");
out.close();
} catch (IOException ex){
Logger.getLogger(Main.class.getName().log(Level.SE VERE,null,ex));
}
}
private static String getName(Scanner scan, String string) {
System.out.print(string + "?");
return scan.nextLine();
}
private static String getSymbol(Scanner scan, String string) {
System.out.print(string + "?");
return scan.nextLine();
}
private static String getSummary(Scanner scan, String string) {
System.out.print(string + "?");
return scan.nextLine();
}
private static String getQuestion(Scanner scan, String string) {
System.out.print(string + "?");
return scan.nextLine();
}
private static String getAnswer(Scanner scan, String string) {
System.out.println(string + "?");
return scan.nextLine();
}
private static String getTitle(Scanner scan, String string) {
System.out.print(string + "?");
return scan.nextLine();
}
}
The major issue deals with the line, "Logger.getLogger(Main.class.getName().log(Level.S EVERE,null,ex));". According to NetBeans my JDK, it's stating it cannot find a symbol. Now, after doing research I found it might have to due with either the name of the class being misspelled or undefined? I do not think it is the former observation, given I believe the class is spelled right. However, I am perplexed to say the least as to how to resolve this error.
All in all, I thank everyone very much for listening to me.