Thread: C++ or Java

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    21

    C++ or Java

    I know basic C(not in deep,you can say simple basics) but now i want to learn C++ or Java.Firstly i want to know if i am taking a good step or not.
    Secondly,I want to master atleast one language..

    So please tell me which language i should pick C++ or Java.
    I want really want to learn one of them to the expert level...

    Please help out guys...

  2. #2
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    I'd say C++, but I don't have a clever reason, other than that almost everyone on here says Java isn't as good as C++ xP
    Someone will prolly give you a better reason
    Currently research OpenGL

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Oh goody, it's been several minutes since the last "X or Y" thread, let's have another one.

    > So please tell me which language i should pick C++ or Java.
    C++.

    Actually, does it really matter?
    Knowing "HOW" to program is far more important than the "programming with...". The former is real knowledge. The latter you can do with the "knowledge" and a decent book.

    Actually, here's a better though.
    "What kinds of programs actually interest YOU?"

    There's little point in learning C++ if all you want to do is write web programs for example.

    > Secondly,I want to master atleast one language..
    C will take between 10 and 20 years (if you use it every day)
    C++, with all the extra things is has, is probably unachievable in a lifetime.
    If you just settle for competent, you'll be doing a hell of a lot better than a lot of people.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    26
    Quote Originally Posted by Salem View Post
    Knowing "HOW" to program is far more important than the "programming with...".
    It's true, but programming with java you probably won't need soon to know how things work, because there are many classes already written for you the same thing with delphi, so i would suggest you learning c++

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I don't know either one, but as I understand it you can easily mix C code into C++, so depending on how good you are with C/and or how much you like it, you would probably be much more inclined toward C++.

    But the world is a better place with alternatives, and they wouldn't exist if someone didn't choose them. So, thinking holistically, perhaps the best idea would be for me to learn C++ and you to learn Java!
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    21
    I have interest in graphical and game programming....

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by ankitsinghal_89 View Post
    I have interest in graphical and game programming....
    Well, as it is now I believe that will be pretty much a C++ stronghold. This is why you have to get to work with the Java right away.

    Seriously tho, before I started with C I worked with perl alot, which has O-O classes (that I didn't take much interest in). What I did do was write functions that dealt with some general principle (eg, for handling user data) and included a parameter to specify a specific task or method ("new" would parallel "constructor", I think) so the function was kind of like several functions rolled into one, possibly dealing with the same set of global variables or whatever. Then someone pointed out to me that this is object oriented programming and that I might as well use the class system (which I believe was a later addition to perl).

    The point being, I doubt there is a limit to what you can do in most languages compared to another, it's really about the syntax of how you can do it. So obviously check them both out and decide what you like. In the end, if you pick Java and in a few years get to a point where you really believe what you are doing will work better in C++, it won't be such a big deal to switch over, methinks (that's the general knowledge).

    Optionally, I would just stick with C for a while. Why not? If you need some excitement (you say you want to get into graphics and gaming) find an API and learn it.

    Which brings up an important and very real difference (I would guess that 95% of API's available for Java are also available for C++, but the inverse is certainly not true).
    Last edited by MK27; 03-01-2009 at 08:30 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    If you want to write games, then C++ is your best choice, because that's what most modern games are written in.
    Otherwise it's just apples vs oranges. No language is not superior over another in all sorts of ways. It's called using the right tool for the job.
    So if not for games, the question becomes what do YOU want to do?
    Choose the programming language based on that criteria.
    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.

  9. #9
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I've talked with several Java programmers that have the incorrect assumption that since they can do Java they can do C++. This is not true at all since the languages differ greatly from one another. If you learn object oriented concepts that are not language specific then you will have a better understanding of how each language implements said concepts.

    But asking which language you should learn on a C++ forum is a bit odd. Because we are going to say: C++.

    But as has been said languages are tools so use the right one for the job and you cannot go wrong. Java just happens to be a tool that isn't in my toolbox. Perhaps someday when Java makes me money it will be but until then it means nothing to me. C++ and C# are my two languages of choice with C++ being my preference.

    So where does that leave you? Right where you should be. The answer is which one do you need to learn first or which one do you want to learn first? We cannot make the decision for you.

    > Secondly,I want to master atleast one language..
    No matter how much you know about C++ and its applications there is always something you do not know. 'Mastering' when it comes to C++ is a very strong word indeed.
    Last edited by VirtualAce; 03-01-2009 at 12:54 PM.

  10. #10
    Registered User
    Join Date
    Jan 2009
    Posts
    21
    Thx for the advice
    i have one more thing to ask which is can java be learned without any difficulty without learning c++..

  11. #11
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    As said before, they are two independant languages. You don't need to know C++ to learn Java, you do not need to know Java to learn C++.

    The only thing it will give you is an idea of how the language concepts may work.
    Double Helix STL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mats, the java answers
    By Jaqui in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 04-22-2008, 02:12 AM
  2. C#, Java, C++
    By incognito in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 10-05-2004, 02:06 PM
  3. 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
  4. 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
  5. Java woes
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 07-06-2003, 12:37 AM