Results 1 to 20 of 32
Thread: Java to C++
- 11-19-2009, 05:08 PM #1
Member
- Join Date
- Nov 2009
- Location
- Abuja, Nigeria
- Posts
- 15
- Rep Power
- 0
Java to C++
Hi everyone!
Please I do need some clarification. I started my programming experience with Java and I can say Im on average so far. However, it seems I might have to take on C++ and C, and I was wondering how its going to be. Normally, you just take the same concept and apply it to the new language and learn the written syntax but given that Java is more dynamic and Object oriented and C is not, not sure about C++. How easy is it going to be to apply my Java knowledge to C/C++? Or would I have to look for Beginner's Guides again?
Thanks for taking a minute to clear my doubts!
Lolu
- 11-19-2009, 05:14 PM #2
Member
- Join Date
- Oct 2009
- Posts
- 15
- Rep Power
- 0
C isn't an object oriented program, so you would like to get some books on that, but so far what I know about C is if you know how to use statements and loops in Java, you will be good there. C you have to declare what type of variable you want, like Java. I don't know about C++ since I never learned C++. Also, C doesn't support strings.
- 11-19-2009, 05:18 PM #3
c++ is pretty similar to Java(well Java is similar to c++ since c++ was around first I guess).
One of the major differences is with C++ you use pointers and pass values by reference instead of actual objects. Also C++ does not have a built in garbage collector like Java does so any object you create you also need to make sure you clean up.
I feel the syntax to C++ is a little more complicated than Java but it's also more powerful.Liberty has never come from the government.
Liberty has always come from the subjects of government.
The history of liberty is the history of resistance.
The history of liberty is a history of the limitation of governmental power, not the increase of it.
- 11-19-2009, 05:18 PM #4
Senior Member
- Join Date
- Nov 2009
- Posts
- 150
- Rep Power
- 4
c++ is in some ways equal to java.
object oriented,... i would go that way.
but why leaving java?
- 11-19-2009, 05:20 PM #5
You'll definitely need a book, as you've got call by value, call by address and call by reference in C++. Also you have to manage the memory (de)allocation yourself.
EDIT: God I'm slow.Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 11-19-2009, 05:20 PM #6
To answer your question you're going to have to look at beginners guides so you can figure out the syntax and probably spend some time on object references and such. Loops, inheritance, OO format, etc all that should be pretty similar. If you look at a chunk of C++ code you could probably figure out most of what's going on.
Liberty has never come from the government.
Liberty has always come from the subjects of government.
The history of liberty is the history of resistance.
The history of liberty is a history of the limitation of governmental power, not the increase of it.
- 11-20-2009, 09:28 AM #7
Member
- Join Date
- Nov 2009
- Location
- Abuja, Nigeria
- Posts
- 15
- Rep Power
- 0
Thanks y'all! It seems C++ will be alot easier to master than C, so I guess I'l just have to get beginners guides to walk me through main features of both languages.
@dino: Im not leaving Java. I could never have the guts to...:) Im just having to learn these two to have an advantage while applying for jobs.
- 11-20-2009, 09:49 PM #8
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,537
- Rep Power
- 11
C (rather than C++) is probably the place to start.Thanks y'all! It seems C++ will be alot easier to master than C
If you are familiar with Java - that is, with programming - consider Kernighan and Richie's The C Programming Language ahead of huge beginner's guides: it lives up to the authors' promise of it being a "small book for a small language".
- 11-20-2009, 11:47 PM #9
The problem with C++ compared to java can get a little complicated with preprocessor directives class defs multiple inheritence and being able to redefine operators ...a c++ class can inherit any number of unrelated classes where the inheritance in java is chained and uses interfaces...
- 11-22-2009, 12:39 AM #10
Member
- Join Date
- Nov 2009
- Location
- Abuja, Nigeria
- Posts
- 15
- Rep Power
- 0
C. I made it a point to express my lack of interest in it. And here I am...lol
@pbrockway2: Thanks for the reference. Will check for the book.
- 11-23-2009, 03:27 PM #11
Member
- Join Date
- Nov 2009
- Posts
- 96
- Rep Power
- 0
C syntax is very similar to Java syntax. I would start learning C and then follow with C++, so you don't get lost with pointers, memory allocation and deallocation, etc. I feel it's easier to start with C and then go with Java, so you will need some books to do it in the other way. The one they recommended to you above is very good if you have some progamming experience (like in this case). Good luck!
- 11-24-2009, 01:33 AM #12
Member
- Join Date
- Nov 2009
- Location
- Abuja, Nigeria
- Posts
- 15
- Rep Power
- 0
Alright. So now that im going Java to C, I hope this is not a case of Jil tumbling down the hill...lol
But in any case, if Java is supposed to be the ultimate programming language, like most dynamic, lets you do more things, object oriented, yada yada yada...why are folks in major Software development companies and related firms still using C and C++? why arent they incorporating java? I dont really get it.
All the java features makes one fall in love with it, and then you get to the real world and you find you dont have enough equipment to farm. ????
- 11-24-2009, 05:25 AM #13
Senior Member
- Join Date
- Nov 2009
- Posts
- 235
- Rep Power
- 4
Just a couple of fun c programs, look at those and tell me if you want to learn c, lol
Winners - about the authors of winning IOCCC entries
take a look at some of the .c files
One program that coverts inputted text into morse code:
Java Code:#define DIT ( #define DAH ) #define __DAH ++ #define DITDAH * #define DAHDIT for #define DIT_DAH malloc #define DAH_DIT gets #define _DAHDIT char _DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:" ;main DIT DAH{_DAHDIT DITDAH _DIT,DITDAH DAH_,DITDAH DIT_, DITDAH _DIT_,DITDAH DIT_DAH DIT DAH,DITDAH DAH_DIT DIT DAH;DAHDIT DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT __DAH;_DIT==DAH_DIT DIT _DIT DAH;__DIT DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH DAH_;__DIT DIT DITDAH _DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT DIT' 'DAH,DAH_ __DAH DAH DAHDIT DIT DITDAH DIT_=2,_DIT_=_DAH_; DITDAH _DIT_&&DIT DITDAH _DIT_!=DIT DITDAH DAH_>='a'? DITDAH DAH_&223:DITDAH DAH_ DAH DAH; DIT DITDAH DIT_ DAH __DAH,_DIT_ __DAH DAH DITDAH DIT_+= DIT DITDAH _DIT_>='a'? DITDAH _DIT_-'a':0 DAH;}_DAH DIT DIT_ DAH{ __DIT DIT DIT_>3?_DAH DIT DIT_>>1 DAH:'\0'DAH;return DIT_&1?'-':'.';}__DIT DIT DIT_ DAH _DAHDIT DIT_;{DIT void DAH write DIT 1,&DIT_,1 DAH;}
- 11-24-2009, 11:39 AM #14
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Because those firms already have a large investement in those languages in terms of code. Or they're techie companies, or defence, or comms, or or or.
Or, as the thing I'm looking at at the moment, it happens to be the quickest way to deliver a solution to the client (COM gubbins). To be honest there's lots of reasons, hopefully to do with "right tool for the job", but not always.
Still, this'll be the first C++ I've done in nigh on 10 years, bar toying with game frameworks...which doesn't realy count.
- 11-26-2009, 12:14 AM #15
Member
- Join Date
- Dec 2008
- Posts
- 28
- Rep Power
- 0
If you study Bohm-Jacopini's theorems, you just could program in every language. But don't forget to practicse yourself in programming without garbage collector and automatic memory allocation, because it's painful at first steps. Believe me, if you plan to make BIG projects, forget C++ and C if you don't know the basics about them. Maybe you'll need templates and strange data structures, and Java just do the job for you. If you plan to learn C or C++, take a look from the start: begin with C and practicse with the base syntax, then study from the only one book that it's worth to be read: the Kernighan and Ritchie. After, you can go to C++ and, if you studied that book, you could have all the world of programming in your hand. Don't forget to study algorhythm's theory, because it's fundamental to have a "slim" and fast computation when you have to allocate memory by yourself, often without knowing how much really you need.
:-)Last edited by hendrix79; 11-26-2009 at 12:20 AM.
- 11-26-2009, 04:58 PM #16
C++ is probably the most powerful language, in my opinion, you can imbed assembler into your code you have more control over the computer but it is very hard to debug because they don't use exceptions and you can chase the addresses of your data.. The nice thing about java is that it is a more managable language ....C++ programs for gaming and multimedia can get very complex...it is much harder to grasp the structure of the code in c++....
- 11-27-2009, 11:16 AM #17
Member
- Join Date
- Nov 2009
- Location
- Abuja, Nigeria
- Posts
- 15
- Rep Power
- 0
- 11-27-2009, 11:49 AM #18
Member
- Join Date
- Nov 2009
- Location
- Abuja, Nigeria
- Posts
- 15
- Rep Power
- 0
@Tolls: How 'right' is C/C++ if Java is supposed to do things better? Wldnt that make Java the 'best tool for the job'?
@hendrix: Thanks for the pointers. Im going to look out for those. i already got the C Programming language book. I'l go check out the Bohm-Jacopini's theorem thingy.
[By the way, Y'all wonderfull! i do appreciate all the contributions!]
- 11-27-2009, 11:57 AM #19
Member
- Join Date
- Nov 2009
- Location
- Abuja, Nigeria
- Posts
- 15
- Rep Power
- 0
Oh, I forgot to mention: The C Programming Language book i got is a 1988 print. Am I on track? Or do l need to look for a later version?
- 11-27-2009, 02:13 PM #20
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,374
- Blog Entries
- 7
- Rep Power
- 17


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks