我知道有一个程序代码可以打印自己,Quine code
如下所示
public class Quine
{
public static void main( String[] args )
{
char q = 34; // Quotation mark character
String[] l = { // Array of source code
"public class Quine",
"{",
" public static void main( String[] args )",
" {",
" char q = 34; // Quotation mark character",
" String[] l = { // Array of source code",
" ",
" };",
" for( int i = 0; i < 6; i++ ) // Print opening code",
" System.out.println( l[i] );",
" for( int i = 0; i < l.length; i++ ) // Print string array",
" System.out.println( l[6] + q + l[i] + q + ',' );",
" for( int i = 7; i < l.length; i++ ) // Print this code",
" System.out.println( l[i] );",
" }",
"}",
};
for( int i = 0; i < 6; i++ ) // Print opening code
System.out.println( l[i] );
for( int i = 0; i < l.length; i++ ) // Print string array
System.out.println( l[6] + q + l[i] + q + ',' );
for( int i = 7; i < l.length; i++ ) // Print this code
System.out.println( l[i] );
}
}
是否有另一个打印自身的 Java 程序代码?