Like Tree1Likes

From C to Java

This is a discussion on From C to Java within the C Programming forums, part of the General Programming Boards category; Hey, I'm studying C but my next language will be Java. I'm wondering - other than flow of control and ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    43

    From C to Java

    Hey,

    I'm studying C but my next language will be Java. I'm wondering - other than flow of control and data structures like arrays and pointers - how much of what I'm learning will carry over to Java?

    How different is OOP from C?
    Is OOP easer or than C?

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Pointers don't necessarily carry over, but a good understanding of what pointers are and how they work is a good thing anyway.

    Flow control is about the same - if, else if, else. Switch/case/when are similar. Break & continue are the same.

    All the relational operators are the same, and most of the other types of operators are either the same or just a little different - same concepts apply obviously.

    No memory management to speak of in Java, compared to C. Scoping & visibility of variables is similar.

    Java, of course, brings in the whole OO paradigm, with was modeled after C++.

    I like both languages. Java is a bit overwhelming when coming from C, because so much of the language and use is built around all the extensive classes and libraries that exist.

    I do like the OOP paradigm, but coming from a career in procedural programming, I do find myself programming with a bent towards that model.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    58
    Java means nothing if not related to the "Java technology". When talk about Java we must consider - at least - Java Virtual Machine which is it's so called "run-time framework".
    The C family goes"up" to C#, and C# is close to Java but on a different framework, the Microsoft's .NET.
    Like most of the operating systems, Windows had been developed in C, then in C++ (the Win32 APIs). It still is in XP and Vista, only that these C++ APIs are wrapped into .Net classes of which C# takes fully advantage as Java of "Java technology" (aka JEE).
    Learning C will drive you to the best computer understanding, all the rest is based upon, except for the "Internet languages". A remarkable language of that kind is PHP, but thats' another story.
    C# is very close to Java

  4. #4
    Registered User
    Join Date
    Mar 2007
    Posts
    43
    Good quality responses,much appreciated So it seems I need to start checking out the Java libraries

  5. #5
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Quote Originally Posted by mesmer View Post
    Good quality responses,much appreciated So it seems I need to start checking out the Java libraries
    Just study a Java book or a java tutorial and you will be OK. In a few words, Java is based on C, especially on the syntax, so what you learned from C will be useful for Java. That is why Java is based on C, because everybody knows C and they wanted to use a similar syntax

  6. #6
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Java, the language, how they organizing codes and object oriented paradigm are best.

    But NOT its virtual machine.
    You'll be great disappointed about its performance.

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    Quote Originally Posted by Opariti View Post
    Java means nothing if not related to the "Java technology". When talk about Java we must consider - at least - Java Virtual Machine which is it's so called "run-time framework".
    The C family goes"up" to C#, and C# is close to Java but on a different framework, the Microsoft's .NET.
    Like most of the operating systems, Windows had been developed in C, then in C++ (the Win32 APIs). It still is in XP and Vista, only that these C++ APIs are wrapped into .Net classes of which C# takes fully advantage as Java of "Java technology" (aka JEE).
    Learning C will drive you to the best computer understanding, all the rest is based upon, except for the "Internet languages". A remarkable language of that kind is PHP, but thats' another story.
    C# is very close to Java
    There are no C++ APIs. None.
    What there is are C APIs. And there is also the dotnet framework, which are not APIs, but are modeled to work with all the dotnet languages (C++/CLI, C#, J#?).

    Quote Originally Posted by C_ntua View Post
    Just study a Java book or a java tutorial and you will be OK. In a few words, Java is based on C, especially on the syntax, so what you learned from C will be useful for Java. That is why Java is based on C, because everybody knows C and they wanted to use a similar syntax
    Oh, you would be surprised how different Java is from C, seeing as all the things you had to do manually and with great pain is trivial in Java, as it would be in C++, as well, since Java do, after all, build on C++.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
    hauzer likes this.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  9. #9
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    There are no C++ APIs. None.
    What about MFC?
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  10. #10
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    C++ is based on C, Java is based on C++, C# is based on both C++ and Java. This makes them all based on C in one way or another.

    The syntax follows exactly like that. There are less differences than you would think.

    You just need to know C/C++ compile into machine code which is executed by your operating system. Where as Java/C# compile into byte code which is "decompiled" at runtime by a virtual machine (advantage being cross-platform compatibility, passive garbage collection, etc). When you really understand the basic concepts, it doesn't matter what language you're learning.

    Quote Originally Posted by cpjust View Post
    What about MFC?
    Framework for the Windows API - win32 C.
    Last edited by Dae; 11-01-2008 at 10:37 AM.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    Quote Originally Posted by cpjust View Post
    If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
    Quite!

    Quote Originally Posted by cpjust View Post
    What about MFC?
    But cpjust, MFC is a framework and not API... you should know that.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
    Why there is so many language inherited from Java concepts then?

  13. #13
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by audinue View Post
    Why there is so many language inherited from Java concepts then?
    So many? How many? C#.. ActionScript.. Java didn't invent OOP or anything.

    It's still 1 step forward. It's a good concept. It's like theorycraft. Psuedocode. It just doesn't play out as well as one would hope all the time. There's a lot less flexibility. As with most languages, sacrifices, pros and cons. Side-note, the syntax is a little verbose at times.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  14. #14
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    Quite!


    But cpjust, MFC is a framework and not API... you should know that.
    Well you mentioned the .NET framework, so I mentioned MFC.
    Although technically, .NET and MFC (and Boost and...) are also API's (or at least have their own API's), they just aren't Windows API.

    Quote Originally Posted by audinue View Post
    Why there is so many language inherited from Java concepts then?
    Maybe because Java is assimilating too many programmers, who then try to create a better language out of frustration?
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  15. #15
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    java unlike C is an object oriented language

    and there is no pointers in JAVA

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C#, Java, C++
    By incognito in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 10-05-2004, 02:06 PM
  2. First Java Class at college
    By GanglyLamb in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 09-29-2004, 10:38 PM
  3. The Java language is being expanded
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 06-11-2004, 09:07 PM
  4. Java woes
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 07-06-2003, 12:37 AM
  5. C or Java as a first language
    By CorJava in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 10-23-2002, 05:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21