Skip to content

Instantly share code, notes, and snippets.

@garymacindoe
Last active November 3, 2016 17:13
Show Gist options
  • Save garymacindoe/433d44d8f517a6a34b4d21e1fadcede1 to your computer and use it in GitHub Desktop.
Save garymacindoe/433d44d8f517a6a34b4d21e1fadcede1 to your computer and use it in GitHub Desktop.
Code that is both valid C and Java
//\
public class C { //\
public static void main(String[] args) { //\
System.out.println("hello"/*
#include <stdio.h>
int main() {
{
return puts("world"/**/);
}
}
//\
public class C { //\
public static void main(String[] args) { //\
System.out.println("hello"/*
#include <stdio.h>
int main() {
{
return puts("world"/**/);
}
}
@garymacindoe
Copy link
Author

$ javac C.java
$ gcc java.c -o java
$ java C && ./java
hello
world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment