Java | Difference between C and Java

05 min read

Difference between C and Java:

  • No 'sizeof' and 'typedef' in java.
  • Data types like 'struct' and 'union' are not available in java.
  • Keywords like auto, extern, register, signed, unsigned are not present in Java.
  • Explicit pointer type is not present.
  • Java doesn't have a preprocessor. So it cannot use #define, #ifdef, #include etc
  • Functions with no arguments must be declared with empty parenthesis and not 'void' keyword, which is allowed in C.
  • Adds labeled break and continue statements in Java.
  • Adds new operators such as >>> and 'instanceof'  in Java.
POST A NEW COMMENT
     
  • Input (stdin)

    Output (stdout)


    Input (stdin)

    Your Output (stdout)

    Expected Output

    Compiler Message

    Input (stdin)

    2    3

    Your Output (stdout)

    5

    Expected Output

    5

    Compiler Message

    5

    Error