Home > Programming > 10 Major Differences Between C And JAVA

10 Major Differences Between C And JAVA

Here are the major differences between C And JAVA.

1. JAVA is Object-Oriented while C is procedural. Different Paradigms, that is.

Most differences between the features of the two languages arise due to the use of different programming paradigms. C breaks down to functions while JAVA breaks down to Objects. C is more procedure-oriented while JAVA is data-oriented.

2. Java is an Interpreted language while C is a compiled language.

We all know what a compiler does. It takes your code & translates it into something the machine can understand-that is to say-0's & 1's-the machine-level code. That's exactly what happens with our C code-it gets 'compiled'. While with JAVA, the code is first transformed to what is called the bytecode. This bytecode is then executed by the JVM(Java Virtual Machine). For the same reason, JAVA code is more portable.

3. C is a low-level language while JAVA is a high-level language.

C is a low-level language(difficult interpretation for the user, closer significance to the machine-level code) while JAVA is a high-level lagunage(abstracted from the machine-level details, closer significance to the program itself).

4. C uses the top-down {sharp & smooth} approach while JAVA uses the bottom-up {on the rocks} approach.

In C, formulating the program begins by defining the whole and then splitting them into smaller elements. JAVA(and C++ and other OOP languages) follows the bottom-up approach where the smaller elements combine together to form the whole.

5. Pointer go backstage in JAVA while C requires explicit handling of pointers.

When it comes to JAVA, we don't need the *'s & &'s to deal with pointers & their addressing. More formally, there is no pointer syntax required in JAVA. It does what it needs to do. While in JAVA, we do create references for objects.

6. The Behind-the-scenes Memory Management with JAVA & The User-Based Memory Management in C.

Remember 'malloc' & 'free'? Those are the library calls used in C to allocate & free chunks of memory for specific data(specified using the keyword 'sizeof'). Hence in C, the memory is managed by the user while JAVA uses a garbage collector that deletes the objects that no longer have any references to them.

7. JAVA supports Method Overloading while C does not support overloading at all.

JAVA supports function or method overloading-that is we can have two or more functions with the same name(with certain varying parameters like return types to allow the machine to differentiate between them). That it to say, we can overload methods with the same name having different method signatures. JAVA(unlike C++), does not support Operator Overloading while C does not allow overloading at all.

8. Unlike C, JAVA does not support Preprocessors, & does not really them.

The preprocessor directives like #include & #define, etc are considered one of the most essential elements of C programming. However, there are no preprocessors in JAVA. JAVA uses other alternatives for the preprocessors. For instance, public static final is used instead of the #define preprocessor. Java maps class names to a directory and file structure instead of the #include used to include files in C.

9. The standard Input & Output Functions.

Although this difference might not hold any conceptual(intuitive) significance, but it's maybe just the tradition. C uses the printf & scanf functions as its standard input & output while JAVA uses the System.out.print & System.in.read functions.

10. Exception Handling in JAVA And the errors & crashes in C.

When an error occurs in a Java program it results in an exception being thrown. It can then be handled using various exception handling techniques. While in C, if there's an error, there IS an error.

  1. hany
    April 19th, 2011 at 05:11 | #1

    nice

  2. hany
    April 19th, 2011 at 05:12 | #2

    very useful
    thankqqqqq

  3. Elly
    April 20th, 2011 at 03:06 | #3

    Great (^>^)
    ✿ Help me a lot during exams ✿

  4. July 13th, 2011 at 03:02 | #4

    very useful & explained all the differences in detailed. THANK YOU

  5. July 13th, 2011 at 03:04 | #5

    All the differences are explained in details. ThaNKQQQQQQQQ

  6. sampath
    August 2nd, 2011 at 04:18 | #6

    i want to know more about c++ and java

  7. jiban
    August 10th, 2011 at 01:17 | #7

    i think a answer that the difference between C,C++ and java is only ABSTRACTION. bcz there is no abstraction in C but in C++ there is abstraction but in java there is more abstraction. is this answer is correct?

  8. meghana
    August 13th, 2011 at 00:40 | #8

    by far the best explanation ever..

  9. August 14th, 2011 at 00:48 | #9

    meghana :

    by far the best explanation ever..

    I suspected that.. ;)

  10. arpita
    August 14th, 2011 at 10:55 | #10

    Thank u so much. It'll help a lot during campusing.

  11. August 14th, 2011 at 10:57 | #11

    arpita :

    Thank u so much. It’ll help a lot during campusing.

    It definitely will.. :)

  12. Kabirul
    August 21st, 2011 at 00:19 | #12

    Thank u....It is really helpful........

  13. rahul
    August 22nd, 2011 at 12:07 | #13

    fadu......

    can include
    threads
    more gui based
    All the primitive types in Java have well-defined sizes. In C, the size of short, int, and long types is platform-dependent, which hampers portability
    Java doesn't support a goto statement.
    C requires local variable declarations to be made at the beginning of a method or block, while Java allows them anywhere in a method or block.
    The Java compiler is smarter than the C compiler, in that it allows methods to be invoked before they are defined.
    Java doesn't support C struct and union types.

    rahul.me.408@gmail.com

  14. August 29th, 2011 at 01:09 | #14

    thanq so much it is very useful to us

  15. SYAMALA
    September 17th, 2011 at 10:55 | #15

    THANKS A LOT.IT IS VERY HELPFUL.

  16. abinaya
    September 21st, 2011 at 02:39 | #16

    thank you

  17. September 21st, 2011 at 19:16 | #17

    @Rahul - Thank you for the reply. Nice points. I will review it and add an update on the post.

  18. September 21st, 2011 at 19:17 | #18

    @rahuram;syamala;abinaya - I'm glad I could help.. :)

  19. Ratika
    October 17th, 2011 at 01:01 | #19

    Thank u its very helpfull and informative...and important from the point of view of Interviews...Thanks a lot

  20. santhosh
    October 20th, 2011 at 03:29 | #20

    thank you so much it clear and very use full

  21. Amit Saxena
    December 17th, 2011 at 11:00 | #21

    A hub of very useful information for beginners as well as the experts

  22. January 7th, 2012 at 10:25 | #22

    the explanation was very gud. I will surely helpfull to us...

  23. navya
    January 19th, 2012 at 16:04 | #23

    thank u.....its v.v useful for us..

  24. January 24th, 2012 at 09:27 | #24

    @puneeth
    thank u so much. really nice

  25. January 25th, 2012 at 09:49 | #25

    it's very useful for me thank's.

  26. ravindra
    January 26th, 2012 at 13:27 | #26

    very nice

  27. mmmmmmm
    January 27th, 2012 at 14:13 | #27

    nice.... excelllent.... very useful......

  28. SWAMY
    February 22nd, 2012 at 10:59 | #28

    ITS NICE HELPING ALOT THANK U

  29. anilkumar
    February 23rd, 2012 at 07:11 | #29

    Thanks.. its vry helpful to me..

  30. Shinny
    March 8th, 2012 at 18:21 | #30

    Usefull

  31. March 12th, 2012 at 11:58 | #31

    its very helpful.........thanq

  32. March 12th, 2012 at 11:59 | #32

    gr8....thanq

  33. Melody
    March 20th, 2012 at 13:35 | #33

    this comparison is very helpful...thankq

  34. kishor kumar
    April 1st, 2012 at 15:27 | #34

    This comparison will be very much useful to crack the interview...Thank U.....

  35. kavya
    April 4th, 2012 at 03:13 | #35

    very useful..and explained in detail

  36. soumya
    May 17th, 2012 at 10:36 | #36

    this comparison is very good........ thank you so much......... Excellent

  1. August 4th, 2011 at 17:40 | #1