I want to learn Java and so far the syntax seems identical to C++. Should I just continue to learn from ground up and wade through stuff I already know or should I look up specific topics to learn Java?
I found the same thing when learning Java. It is probably still helpful to have a quick look through, though, as some things are different (such as "Boolean" rather than bool, and the forced parenthese for default constructors of objects). The major differences are in terms of inheritance, such as "implements" or "extends", and the rules following them.
Apart from that, just learn about the libraries associated with the particular branch of programming that you endeavour to be doing, such as JOGL for low-level graphics development.
Syntactically, there is very little difference between C++ and Java.
The huge, mind-boggling differences are in the way you program effectively in each language. The way you think and program in C++ completely contradicts how you think and program in Java, and learning to keep them separate in your head will be difficult.
Do not go into Java and try to bring C++ with you - trust me, I tried it and it doesn't work.
Skim read/look through similar stuff and concentrate read/look on not so similar stuff. That way both are covered: 1) You see how similar things are done in the Java way. 2) You get familiar with new things.
He meant that if you go into trying to learn Java thinking that it works the same way C++ does so you do things the same way you do things in C++ you will fail miserably.
Basically he is pointing out that they look similar but you don't code the same way in Java as you would in C++.
Ok, one thing that kinda bugs me, this may be a dumb question, it's about the curly braces for starting and ending a block. In C++ I've been doing it like
1 2 3 4 5 6 7 8
void function()
{
//code goes here
}
void function2()
{
//code goes here
}
but all the Java stuff is
1 2 3 4 5 6
void function(){
//code goes here
}
void function2(){
//code goes here
}
but I much prefer the C++ way, do you think it's ok to continue this, or when writing Java should I do ti the Java way?
Comparing what these two technologies do under the hood is like comparing apples to platypuses. "Just don't make no sense." From a syntatic perspective, similar but different. Can I use both languages to accomplish almost anything? Sure1. The underlying java native implementation is C anyhow. Learn both, each has its place in your tool belt.
On the formatting note, almost every IDE that's worth its own weight will allow for 1-click automatic code formatting of an entire project.
1 - Applets2? Sure, you can call native code from an applet, as well as launch JVM's from native code.
2 - Soon you'll have to pay a $200 / $600 annual fee to provide applet / web-start technologies to your clients, so I think we can expect a sharp decline in this area...but I digress :)
Soon you'll have to pay a $200 / $600 annual fee to provide applet / web-start technologies to your clients, so I think we can expect a sharp decline in this area...but I digress :)
Link?
Anyway, noone sane is writing applets these days, if you can cross-compile Java to JavaScript easily with GWT with only a 2-10x runtime performance penalty (and this is usually closer to 2x-3x in most situations). And you can do exactly the same with C++ - compile to asm.js with LLVM.
@rapidcoder - Launch any unsigned or self-signed applet or JWS application with a recent JRE and read the dialog. Anything unsigned, or signed from an unverified publisher will be blocked in a future release. From what I understand of the verification process: it's on a per-application basis, the certificate expires annually and must be renewed (for ~200 - 600 USD, as thwarte no longer offers free verification), and it takes time for your code to clear the review board assigned to assess it.
Of course, your clients can (most likely?) configure this on their end, but how many users can rationally be expected to correctly adjust their JRE security settings?
It's very obvious that Oracle can do nothing to realistically fix this technology (zero-day attacks) short of making the cost and pain to malicious users outweigh what they'll be getting out of their trouble. It was a good attempt at a 'secure' sandbox, however...
If you want to continue the discussion, we can start a new thread.
COBOL is cool and they pay devs a lot of money who know it. Haskell is something I want to learn because a lot of people talk about it. Anyway if you want to continue this discussion I can make a new thread, I don't want to derail this.