Identify the compiler The challenge
You are given a function compile(s: String): Integer which returns 0 if s could be compiled and anything other than 0 if it failed (the resulting code is not important).

The thing is that you don't know for what language the function is made for, so it is up to you to figure that out by giving the function small snippets of code and observing what it returns. The good part is that a team of scientists have tried before you and have narrowed down the list to C, C++, C#, Java and JavaScript (these are the only widespread languages which have similar syntax I could think of).

Rules  


General code-golf rules apply.
There is no strict output format; as long as it's readable and understandable it's ok.
If these 5 languages are not enough for you then you can add your own favourites and you'll be rewarded with extra stars (★) (that do nothing).


Note1: the compiler is up to date with the latest standard of whatever language it's designed for.
Note2: I know JavaScript does not compile, but it goes though some parsing process; if it's valid JavaScript code then it passes
Total snippet length 8; test program 83 (C)

Distinguish JavaScript and C from C++, Java, and C#

a;


Distinguish JavaScript from C

0


Distinguish C++ from C# and Java

#


Distinguish C# and Java

[:a]


C code to determine the language

#define C(x)compile(#x)?
main(){puts(C(a;)C(#)C([:a])"J":"C#":"C+":C(0)"C":"JS");}


Snippets tested with

C: gcc 4.7.2 with -std=c99
C++: g++ 4.7.2 with -std=c++11
Java: javac 1.7.0_09
JavaScript: JavaScript-C 1.8.5
C#: Mono C# compiler version 2.10.8.0