Search code examples
javatheoryquine

Does this code qualify as a Quine in Java?


Here's the code. It basically reads from the original code file and prints onto the terminal.

import java.io.*;
public class Quine
{
    static void Quine() throws IOException
    {
        FileReader fr = new FileReader("C:/Quine.java");        
        BufferedReader br = new BufferedReader(fr);
        String s = "";
        while((s = br.readLine()) != null)
        {
           System.out.println(s);
        }
    }
}

Practically, it works just fine, producing the same exact code as output. But by definition, does it qualify as a quine? Considering I'm still passing a file to it as a parameter. Despite it being a programmer-specified and not a user-entered input, is it still considered an input?


Solution

  • It is not considered a valid quine, you have to avoid any I/O operation.

    Opening the source code to print it out it's the first cheat to avoid!