Java source and binaries are entirely portable, since the source format is standardized, and the binaries run on a software emulation of a standardized processor (JVM).
In C, binaries are not usually portable from one platform to another, because they use the platform's native hardware processor directly. However, C source can be portable with little modification if it adheres to an ISO C standard, e.g., C90 (ISO/IEC 9899-1990), C95 (ISO/IEC 9899-1995), C99 (ISO/IEC 9899-1999) or C11 (ISO/IEC 9899-2011), so long as the additional libraries it uses are also portable.