Why does SOUT tab not work?
Answered
This just randomly started happening
sout tab goes to just out.println
import java.awt.*;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import static java.lang.System.out;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static java.nio.file.StandardOpenOption.CREATE;
import javax.swing.*;
import java.util.ArrayList;
import java.io.FileReader;
import java.util.Scanner;
public class FinalProject {
static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
JFileChooser chooser = new JFileChooser();
File selectedFile;
String rec = "";
ArrayList <String>lines= new ArrayList<>();
try {
File workingDirectory = new File(System.getProperty("user.dir"));
chooser.setCurrentDirectory(workingDirectory);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
selectedFile = chooser.getSelectedFile();
Path file = selectedFile.toPath();
InputStream inl =
new BufferedInputStream(Files.newInputStream(file, CREATE));
BufferedReader reader =
new BufferedReader(new InputStreamReader(inl));
while (reader.ready()){
rec = reader.readLine();
lines.add(rec);
}
}
} catch (HeadlessException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void intro (){
Boolean plagame = false;
plagame = SafeInput.getYNConfirm(in, "Do you want to play a game?");
if (plagame == false){
System.exit(0);
}
else {}
}
}
Why??
Please sign in to leave a comment.
Do you have a static import added for the System package? Please share the complete .java file.
Updated to add the entire code file, there is one static import.
How does that affect the sout function?
You have this static import as well:
Oh, I didn't see that, thanks!