懂C++,学Java需要多长时间?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/719124/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Knowing C++, how long does it take to learn Java?
提问by Dan Hook
I am a competent C++ developer. I understand and use polymorphism, templates, the STL, and I have a solid grasp of how streams work. For all practical purposes, I've done no Java development. I'm sure some of you were in a similar situation at one point when you had to learn Java. How long did it take you to become a competent Java programmer?
我是一名称职的 C++ 开发人员。我理解并使用多态性、模板、STL,并且我对流的工作原理有深刻的了解。出于所有实际目的,我没有做过 Java 开发。我敢肯定,你们中的一些人在必须学习 Java 时曾遇到过类似的情况。你花了多长时间成为一名合格的 Java 程序员?
采纳答案by Uri
I think that learning the language is not difficult. In fact, I used to be a full time C++ developer, and at some point I started writing Java code. But the thing is that I don't remember ever learning Java, so I guess I just figured it as I went. I've been doing full time Java for a long time now.
我认为学习语言并不难。事实上,我曾经是一名全职的 C++ 开发人员,在某个时候我开始编写 Java 代码。但问题是我不记得曾经学习过 Java,所以我想我只是边走边想。我已经做了很长时间的全职 Java。
If you are well familiar with C++, you may want to read a list of the major differences (e.g., everything is dynamically-bound) and then start practicing on an environment (just download Eclipse). The small differences are the main thing you would have to get adjusted to.
如果您非常熟悉 C++,您可能想要阅读主要差异的列表(例如,一切都是动态绑定的),然后开始在环境中练习(只需下载 Eclipse)。细微的差异是您必须适应的主要因素。
Now that Java supports generics, one of the major switching pains is gone. Multiple inheritance, while not supported, is not a big deal if you get used to interfaces, and in fact having interfaces rather than abstract classes with pure virtual functions (PVFs) improves readability.
既然 Java 支持泛型,主要的切换难题之一就消失了。多重继承虽然不受支持,但如果您习惯了接口,那就没什么大不了的,事实上,拥有接口而不是具有纯虚函数 (PVF) 的抽象类可以提高可读性。
To me Java is a nice and friendly and relaxing sandboxed version of C++. I don't have to worry about general protection faults (GPFs), I don't have to worry about memory leaks, I don't have to worry about messing with pointers. However, don't let that confuse you, there are still plenty of opportunities to screw up royally, and they're sometimes even nastier to detect.
对我来说,Java 是 C++ 的一个很好、友好和轻松的沙盒版本。我不必担心一般保护错误 (GPF),我不必担心内存泄漏,我不必担心弄乱指针。但是,不要让这让您感到困惑,仍然有很多机会可以彻底搞砸,有时甚至更难发现。
Just take the leap. If you have the instinct, it shouldn't be a problem.
只管飞跃。如果你有本能,这应该不是问题。
回答by JaredPar
I went the opposite way. Started with Java, then moved to C and C++. For my own personal experience, it was much easier to learn Java than C/C++ (C++ especially).
我走了相反的路。从 Java 开始,然后转向 C 和 C++。就我个人的经验而言,学习 Java 比 C/C++(尤其是 C++)容易得多。
Java in many ways is meant to be C++ with many of the undefined and unnecessarily complicated portions removed or simplified. IMHO, it had great success with that goal. As a result it's a very easy language to learn and use. Especially for someone who is familiar with C++.
Java 在很多方面都意味着 C++,删除或简化了许多未定义和不必要的复杂部分。恕我直言,它在这个目标上取得了巨大的成功。因此,它是一种非常容易学习和使用的语言。特别是对于熟悉 C++ 的人。
The actual time it will take is very dependent upon the person learning the language. However, I think it's safe to say it will take less time to become competent in Java than it did in C++.
实际需要的时间很大程度上取决于学习语言的人。但是,我认为可以肯定地说,与 C++ 相比,掌握 Java 所需的时间更少。
回答by CookieOfFortune
Shouldn't be too bad. The syntax and classes should be very easy for you to grasp. There are some differences but none of it is too challenging.
应该不会太差。语法和类应该很容易让您掌握。有一些差异,但都不是太具有挑战性。
The hardest part is more about learning the packages, since those will be different. The built in Java classes and functions, and then to use Java in a practical manner, you'll need to learn J2EE or whatever you might be actually using it for. The latter part will probably take more of your time than the language itself.
最难的部分更多是关于学习软件包,因为它们会有所不同。内置的 Java 类和函数,然后以实用的方式使用 Java,您需要学习 J2EE 或任何您可能实际使用它的东西。后一部分可能会比语言本身花费更多的时间。
回答by Robert Gould
I know C++, and had to work with Java once and picked it up in 2 weeks. Of course there were quite a few surprises but it's easy.
我知道 C++,并且不得不使用 Java 并在 2 周内学会了它。当然,有不少惊喜,但这很容易。
回答by Eskat0n
I think there are two approaches to meaning of term "competent Java programmer". If it is about lexems, syntax and terms of OOP I began to completly understand Java before 2 (two) days of learning. But firstly you will be charmed by impossibility to shoot your own leg ;) But if it is case of embeded class system (i.e. packages), APIs references, tips-and-tricks and etc., it takes about half-year to feel yourself friendly with Java. I think.
我认为“有能力的 Java 程序员”一词的含义有两种方法。如果是关于 OOP 的词法、语法和术语,我在学习两(两)天之前就开始完全了解 Java。但首先你会被不可能射出自己的腿所吸引;) 但是如果是嵌入式类系统(即包)、API 参考、技巧和窍门等,则需要大约半年的时间来感受自己对Java友好。我认为。
回答by aJ.
I too learnt C++ first and then Java. It took very less time as I was already familiar with OOPS concepts. In the initial phase of learning I was really happy with new concepts in Jave like garbage collector. I referred The Complete Referenceby Herbert Schildt and it did help me to get the syntax quickly.
我也是先学C++,然后是Java。因为我已经熟悉 OOPS 概念,所以花费的时间非常少。在学习的最初阶段,我对 Java 中的新概念(如垃圾收集器)非常满意。我参考了 Herbert Schildt 的The Complete Reference,它确实帮助我快速掌握了语法。
回答by TofuBeer
Back in 1995 when I did it, it took me about half a day to get comfortable with the tools and basic ideas, a day or two to get the language, a week to get the more obscure parts of the language (there were less of them at the time) and a month to get the libraries (there were WAY less of them at that time).
早在 1995 年我做这件事的时候,我花了大约半天的时间来熟悉工具和基本思想,一两天来掌握语言,一周来掌握语言中较晦涩的部分(更少的他们当时)和一个月的时间来获得图书馆(当时的图书馆少得多)。
Now I would guess that the tools and basic language will take as much time, a couple of weeks to a month for the obscure parts of the language (depends on what parts you hit, and when). The basic libraries will be a month to two months (java.lang
, java.util
, and a few others). The remaining class libraries 6 months to forever depending on what you need to learn and how often the keep updating them :-)
现在我猜测工具和基本语言将花费同样多的时间,对于语言的晦涩部分(取决于您击中的部分和时间),需要几周到一个月的时间。基本的图书馆将是一个月到两个月(java.lang
,java.util
,和其他几个人)。剩余的类库 6 个月到永远,具体取决于您需要学习的内容以及不断更新它们的频率:-)
回答by Bill the Lizard
If you're already a competent programmer (especially in C++) then Java doesn't take long to learn at all. The books I would recommend (in order) for anyone who wants to learn Java are:
如果您已经是一名称职的程序员(尤其是在 C++ 方面),那么学习 Java 根本不需要很长时间。我会(按顺序)向任何想要学习 Java 的人推荐的书籍是:
You may find that you zip through Head First Java rather quickly, given your experience. For that reason I suggest you check it out of the library and skim it before moving on to Thinking in Java.
根据您的经验,您可能会发现自己很快就完成了 Head First Java。出于这个原因,我建议您在继续使用 Thinking in Java 之前从库中查看并浏览它。
Also check out Sun's Java Tutorials.
另请查看 Sun 的Java 教程。
回答by ya23
I have C++ background. Picking up Java took me few days - the language seems really simple - at least its basis. I still consult my Java guru - google quite a bit, but it's usually a matter of exploring API and standard libraries. Java has some annoyances, but you should spot most of them them easily and quickly.
我有 C++ 背景。学习 Java 花了我几天时间——这门语言看起来非常简单——至少是它的基础。我仍然经常咨询我的 Java 大师 - 谷歌,但这通常是探索 API 和标准库的问题。Java 有一些烦恼,但您应该轻松快速地发现其中的大部分。
I was recommended Thinking in Java(there's an ebook for free), but was never persistent enough to read through it. I don't write rocket-science code in Java and to do it, my skills are sufficient.
我被推荐使用 Java 思考(有一本免费的电子书),但我从来没有坚持到读完它。我不会用 Java 编写火箭科学代码,而要做到这一点,我的技能就足够了。
Having said that, it would be good to have better formal knowledge of the language. At the moment I'm thinking about studying for SCJP, which seems a sensible way of learning, plus you will get well-recoginized programming certificate once you pass it (I've heard it's not worth much, but still it may be a motivation...).
话虽如此,对语言有更好的正式知识会很好。目前我正在考虑学习SCJP,这似乎是一种明智的学习方式,而且一旦通过,您将获得公认的编程证书(我听说它不值多少钱,但仍然可能是一种动力……)。
You can also try Java Black Belt- the answers frequenty surprises me. After taking few tests I wonder how my programs even compile, which suggests I'm probably not the most competent Java programmer around :)
您也可以尝试Java 黑带- 答案经常让我感到惊讶。在进行了几次测试后,我想知道我的程序是如何编译的,这表明我可能不是最能干的 Java 程序员:)
回答by MetroidFan2002
C++ to Java: 1 week. Java to C++: 1 month.
C++ 到 Java:1 周。Java 到 C++:1 个月。