-->

Friday, March 8, 2013

Java Logical Questions

Posted by Sharath
Java's Quine Program:

Quine Means -

A quine is a computer program which takes no input and produces a copy of its own source code as its only output.

import java.io.*;

public class Quine{

public static void main(String... arg) {

try {
FileInputStream ob = new FileInputStream("<<ABSOLUTE_PATH>>\\Quine.java");

int i = 0;
while ((i = ob.read()) != -1) {
char ch = (char) i;
System.out.print(ch);
}
} catch (IOException exp) {
exp.printStackTrace();
}
}
}


0 comments:

Post a Comment