Thread: C or Java ? Pleas help meee ...

  1. #16
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by ssharish2005 View Post
    I would rather suggest its upto OP decision on which ever langauge he is comfortable . He should go along with that.
    Well it sounds like he hasn't done any programming yet, so that's why he's asking us.
    Based on what he wants to do, it sounds like it would be a LOT less painful to do in Java than in C (just like most things).

  2. #17
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    Quote Originally Posted by cpjust View Post
    Well it sounds like he hasn't done any programming yet, so that's why he's asking us.
    Based on what he wants to do, it sounds like it would be a LOT less painful to do in Java than in C (just like most things).
    Then perhaps, he should start doing some C basics rather than thinking to build a piece of software which is over his head at the movement.

    ssharish
    Last edited by ssharish2005; 12-16-2007 at 11:38 PM.

  3. #18
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    You can still do all the "C basics" in Java, just using different syntax. System.out.println() instead of printf()... So why not learn it on Java first, so he doesn't have to re-learn it all when he moves from C to Java?
    If you're going to program in C++ then I'd probably recommend learning the basics of C first. But Java & C are quite different from one another, so unless you're planning on using both languages, there's no point in learning them both.

    I learned C first, then C++ & Java, but I don't think it would have mattered which order I learned them in.

  4. #19
    Registered User
    Join Date
    Nov 2007
    Location
    Singapore
    Posts
    24
    i learnt C++ then VB then C# then J2SE, then J2ME then C, i would say C is harder than any of those

  5. #20
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Alander View Post
    i learnt C++ then VB then C# then J2SE, then J2ME then C, i would say C is harder than any of those
    Is there a difference between J2SE and J2ME (or J2EE or J???). I just call it all Java, but I haven't really done a whole lot of programming in Java.

  6. #21
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    SE => standard edition
    EE => enterprise edition
    ME => micro edition
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #22
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Thanks, I know what they stand for, but what's different about how you use them? Is it just some extra or fewer Java library classes, or is there any difference in the language itself?

  8. #23
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Is it just some extra or fewer Java library classes, or is there any difference in the language itself?
    I don't know about ME, but EE adds extra classes and tools, at least from what my Java enthusiast friends tell me. Personally, I have only ever used SE.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #24
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Why does it "have" to be Java or C?

    There are a few languages that are very likely to be the "best" chocies here:
    1. Python - it's a "simpler" language than Java, but has all the benefits.
    2. Perl - Nor is this a complex language, but it's very powerful and has lots of database connecting functionality.
    3. PHP - It's commonly used for web-intefaces, and has LOTS of data-base interfacing capabilities.

    Sure, you can use, C, C++ or Java for any of this too.

    Part of the question is "what do you actually want to do with the data". For most instances, the data-base access itself is the bulk of the processing, and the bulk of the code involves forming SQL statements and displaying the output data, rather than actually performing for example calculations ON the data, which means that whatever language you choose will have little impact on the time/performance of the processing, but choosing a language with easy-to-use and comprehensive string handling and dynamic array bindings (like C++ std::maps or similar) will help in making the access of the output of the database easy.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #25
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I second Perl. Absolutely wonderful, then with some programming (or rather, scripting) skills under your belt you can decide on Java or whatever.

    Not a personal fan of Java, but hey it certainly has is purpose (other than Solaris of course ) -- just like everything, the tool for the job! Not like you'd try hammer nails with a screw driver... Well I hope not

  11. #26
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I like how learning C makes you realize how basic a computer's basic operations can be (and even more basic when you learn assembly, etc.). I think it helps train you to realize how the more advanced features of languages work (ie. pointers are used under the hood in other languages), and let's you better appreciate advanced data types and features of other languages.

    An advantage or two of C is the close-to-raw power and speed of your machine. Two advantages of Java is the portability as well as the quickness with which you can write programs. You trade off some of those features in exchange for others.

  12. #27
    Registered User
    Join Date
    Dec 2007
    Posts
    25
    Thank you all for your responses, I really appreciate that.

    Quote Originally Posted by Jamkirk View Post
    im pretty bad at maths, but i love programming, i suppose its a handy thing to have but programming is mostly logic. you'll pick up algorithms as you learn, i program in c, hence why im posting here lol... ive never used java.
    What do you program in C ? database? networking? games, .. ? does it take a lot of time?

    Quote Originally Posted by t3chn0n3rd View Post
    Code:
    /*  A simple C program*/
    #include<stdio.h>
    int main()
    {
    printf("Hello to C forum");
    }
    Thank you very mucht, I can understand you that you welcome me to the forum using that code of C language but the compiler of C can't understand you, because you forget ; and #

    Quote Originally Posted by MacGyver View Post
    Hello world, compliant with both C89 and C99 would be as follows:

    Code:
    #include <stdio.h>
    
    int main(void)
    {
    	printf("Hello, world!\n");
    	return 0;
    }
    In Java it would be as follows:

    Code:
    public class HelloWorld
    {
    	public static void main(String a_szArgs[])
    	{
    		System.out.println("Hello, world!");
    	}
    }
    Both languages have their purposes. Asking on a C forum is going to get you answers to learn C, unless they don't want you in the ranks of C programmers.

    And yes, you need some skill in math. Basic high school algebra is generally sufficient to get started and do quite a few things while learning the language.
    The difference I see in that code is the C languge is compact!

    Quote Originally Posted by Perspective View Post
    I'd go with Java, it has more standard library support for the things you're trying to do, and is probably easier to use since you don't have to worry about memory management.

    (Not that C doesn't have libraries for this stuff, but you'll have to hunt them down and figure out how to use them, and there are really no standards for design or coding style so each one can be different. This is one thing that Java really got right.)
    What does that mean, "I don't have to worry about memory management" and why not in Java ?

    Can you pleans give me an example and tell me which libraries you are talking about ?
    In Java you have for example imports java.sql.*; don't you have this in C ?

    Quote Originally Posted by Elysia View Post
    C vs Java isn't that fair a comparison, is it? Maybe it would be fairer to compare C++ vs Java. If it's C vs Java, Java is probably better.
    I don't like the syntax of C++ like cin>> and cout<< but they are both OO.

    Quote Originally Posted by Bubba View Post
    Asking this on a C board is nutso. Use whatever language is the best tool for the job. If you cannot figure that out on your own then perhaps neither language is appropriate for you.

    Forget your project and just learn to program in a language. Then you can start determining how you want to utilize the language for your project. You are kind of trying to run before you can even walk.
    You right, but I said in the future after mounths or one year of learling the basics ..

    Quote Originally Posted by Elysia View Post
    Unless we go by the "use the right tool for the job" analogy, in which case Java might be better.
    Still, one could just learn both of them, since they both have advantages/disadvantages and get the best of both worlds. Especially in case you'd want to do something else than web a little later on or once in a while.
    What are those advantages and disadvantages?
    I want in the future my project runnig all free, I want to use free compiler, ide, dbms, os, .. everything except hardware

    Quote Originally Posted by cpjust View Post
    Given the choice between C & Java, I'd have to go with Java, even though it is the ugly step-child of C... Also, from what I see on Monster.ca and other job sites, I'd say you'd be a lot more employable learning Java.
    Oh that one!! yes thanks ..

    Quote Originally Posted by ssharish2005 View Post
    I would rather suggest its upto OP decision on which ever langauge he is comfortable . He should go along with that.

    @OP: Question your self which language i am more comfortable with? If you can get the asnwer for that u wouldn't be think so much. By the time you get the right suggestion from other people, u might have finished your software developement.

    ssharish
    Yes I am going to learn the basics of programming in C like:
    variables, constants, expressions, statements, declarations, data types, chars and arrays of chars (Strings), iterations using while and do while, slections with if and else and switch case, arrays, functions, ... that menas I will attack you with questions on this forum hhhh

    Thanks

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by bchaib View Post
    I don't like the syntax of C++ like cin>> and cout<< but they are both OO.
    cin << and cout >> are for beginners. Well, mostly anyway.
    And you don't have to use them either. C++ can be strictly C too.

    Code:
    What are those advantages and disadvantages?
    I want in the future my project runnig all free, I want to use free compiler, ide, dbms, os, .. everything except hardware :)
    So far as I know, Java is more web-oriented; there's no such thing in C/C++ - you need to have external libraries for that. In C, you need to explicitly allocate and free certain type of memory, but AFAIK, in Java you do not (this is not necessary in C++ either, if you do it right).

    But for raw performance and Windows-type apps, C/C++ is better/faster.
    I believe there's a reason why most people/companies write games and applications (for Windows) in C/C++ rather than Java.
    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.

  14. #29
    Registered User
    Join Date
    Dec 2007
    Posts
    25
    Yes, in Java there is applet like this: http://www.physics.uoguelph.ca/apple...st2/index.html
    and they are indeed web-oriented but in java you can programm applications as well.

  15. #30
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It can, but can it be as efficient or good as C/C++? I believe the former has an advantage when it comes to native, non-web applications (and faster as well).
    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.

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. 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
  3. Java woes
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 07-06-2003, 12:37 AM
  4. How to use Java with C++
    By Arrow Mk 84 in forum C++ Programming
    Replies: 2
    Last Post: 02-27-2003, 04:12 PM
  5. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM