我应该同时学习 C++ 和 Java 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/499731/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 15:24:55  来源:igfitidea点击:

Should I learn C++ and Java simultaneously?

javac++

提问by Jami

I'd love to start writing Android apps. That's apparently all in Java. Programming jobs on Craigslist are at least 100 Java to 1 C++. I want to learn Java.

我很想开始编写 Android 应用程序。这显然是 Java 的全部内容。Craigslist 上的编程工作至少是 100 个 Java 到 1 个 C++。我想学习Java。

Unfortunately, the CS program I'm considering teaches C++ rather than Java, so C++ is what I'm learning. (I'm sure learning C++ will teach me to code well, but so would Java, and then I could get a job. It's frustrating that CS programs stick with languages they've used for 20 years instead of teaching languages that will help their students succeed.)

不幸的是,我正在考虑的 CS 程序教 C++ 而不是 Java,所以 C++ 是我正在学习的。(我确信学习 C++ 会教我写好代码,但 Java 也是如此,然后我就能找到工作。令人沮丧的是,CS 程序坚持使用他们已经使用了 20 年的语言,而不是教授对他们有帮助的语言学生成功。)

My question is whether it's a good idea to crack open the Java books on my shelf after I finish my C++ homework. Will I just end up confused, or will I end up better at both? Has anyone learned both C++ and Java simultaneously?

我的问题是,在我完成 C++ 作业后打开书架上的 Java 书籍是否是个好主意。我最终会感到困惑,还是最终两者都更好?有没有人同时学过 C++ 和 Java?

Edit: Thanks for all the quick answers! I've done some programming and I pick up languages easily, I think. Comparing side by side does appeal to me. But I also tend to bite off more than I can chew, and learning C++ and Java both seems like the kind of big meal that could get me in trouble.

编辑:感谢所有快速回答!我已经完成了一些编程,我认为我很容易掌握语言。并排比较确实吸引了我。但我也倾向于咬得比我能咀嚼的多,学习 C++ 和 Java 似乎都是可能给我带来麻烦的大餐。

采纳答案by mmcdole

I don't see a real problem with this. As an added bonus you'll be able to read the books relevant sections side by side and see how they compare and contrast the differences in how the languages handle things.

我看不出这有什么真正的问题。作为一个额外的好处,您将能够并排阅读书籍的相关部分,并了解它们如何比较和对比语言处理事物的差异。

For example as you read about pointers in C++ it might help you visualize how Java reference types work to a certain degree.

例如,当您阅读 C++ 中的指针时,它可能会帮助您在一定程度上了解 Java 引用类型的工作方式。

Don't be frustrated your school teaches C++, be grateful. Read, The Perils of Java Schools. You aren't at a tech school looking to learn the hottest language of the moment. You are there to learn computer science. My school teaches Java as an introductory language and I think it is a huge mistake. We should be learning C instead so by the time we are introduced to Java (in say, Object Oriented class) we will know what is actually going on and nothing "magical" is happening for us.

不要对你的学校教 C++ 感到沮丧,要心存感激。阅读Java 学校的危险。您不是在寻求学习当下最热门语言的技术学校。你在那里学习计算机科学。我的学校教授 Java 作为入门语言,我认为这是一个巨大的错误。我们应该学习 C,所以当我们被介绍到 Java(比如,面向对象的类)时,我们将知道实际发生了什么,并且没有任何“神奇”发生在我们身上。

The knowledge you gain in your degree, and even from using C or C++, will transcend the latest "popular" language.

您在学位中获得的知识,甚至从使用 C 或 C++ 中获得的知识,都将超越最新的“流行”语言。

回答by Johnno Nolan

If you haven't programmed before just learn c++. It has most basic things that JAVA has plus a bit more. When you have got to grips with C++ JAVA will be easy.

如果你之前没有编程过就学习 C++。它具有 JAVA 所具有的最基本的东西,另外还有一些。当您必须掌握 C++ 时,JAVA 会很容易。

回答by Uri

There aren't necessarily more Java jobs than C++ jobs, it varies greatly from region to region; where are you looking?

Java 工作并不一定比 C++ 工作多,它因地区而异;你在看哪里?

I think that C++ is a great foundation, and that learning Java would be easier once you know C++, and that it is generally an easier language to learn. If you have the aptitude for programming, you can learn both languages at the same time.

我认为 C++ 是一个很好的基础,一旦你知道 C++,学习 Java 会更容易,而且它通常是一种更容易学习的语言。如果你有编程的天赋,你可以同时学习两种语言。

However (and that's a big however), if most of the actual programming you do at school is in C++ (homeworks, projects, etc.), and Java is something you'll do as a hobby and less frequently, you will end up being better at C++.

然而(这是一个很大的问题),如果你在学校进行的大部分实际编程都是用 C++ 编写的(家庭作业、项目等),而 Java 是你作为一种爱好而不那么频繁地做的事情,那么你最终会更擅长 C++。

When you go to job interviews, it's better to be good in one language than to be mediocre in both.

当你去面试时,最好是精通一种语言,而不是两种语言都平庸。

回答by Mark Renouf

Learning any number of different languages is always good practice. It can help you better absorb the concepts and theory behind what you are learning rather than focusing on the syntax and keywords. That being said, the ideas are similar enough but it may be frustrating to learn both simultaneously because you may be transposing syntax as you go.

学习任意数量的不同语言总是好的做法。它可以帮助您更好地吸收所学内容背后的概念和理论,而不是专注于语法和关键字。话虽如此,这些想法足够相似,但同时学习两者可能会令人沮丧,因为您可能会在进行时转换语法。

The main difference is garbage collection, and I think once you learn C++ you learn to both understand and appreciate the benefits of a garbage-collected system. Trying to learn Java at the same time may confuse or frustrate you. Learn the key concepts, get a good solid footing with C++, then move on to Java when you're ready.

主要区别在于垃圾收集,我认为一旦您学习了 C++,您就会了解并欣赏垃圾收集系统的好处。尝试同时学习 Java 可能会让您感到困惑或沮丧。学习关键概念,在 C++ 方面打下坚实的基础,然后在准备好后继续学习 Java。

回答by Johannes Schaub - litb

I recommend you to certainly look into both. If your C++ course is finished you will be a better Java programmer and get some work done with it. If you are still getting confused, you can still stop reading the Java books until the course is finished.

我建议你当然看看两者。如果您完成了 C++ 课程,您将成为一名更好的 Java 程序员并完成一些工作。如果您仍然感到困惑,您仍然可以停止阅读 Java 书籍,直到课程结束。

I'm always at learning C++ and other languages at the same time and having fun with it. I certainly would say I'm learning something rather than being confused by it.

我总是同时学习 C++ 和其他语言并从中获得乐趣。我当然会说我正在学习一些东西,而不是被它弄糊涂了。

回答by ypnos

Just ask yourself how easy it is to learn the concepts for you currently. How deep is the understanding you get?

问问自己目前学习这些概念有多么容易。你的理解有多深?

If you understand well, it will be easy for you to distingish and seperate them. If it is somewhat hard for you though, you may probably get confused.

如果你理解得很好,你就很容易区分和区分它们。如果这对你来说有点困难,你可能会感到困惑。

回答by ubiyubix

Learn C++ first. Learn C, too. Learn Lisp or Scheme. Java is going to be a piece of a cake after that.

先学C++。也学C。学习 Lisp 或 Scheme。在那之后,Java 将成为小菜一碟。

回答by Fortyrunner

If you're smart you won't get confused.

如果你聪明,你就不会迷路。

In fact I would say - learn another language as well, Perl or Python.

事实上我会说 - 也学习另一种语言,Perl 或 Python。

回答by Frank

Just learn C++ right now if you think you might get confused learning the two languages at the same time. You don't want to jeopardize your grades.

如果您认为同时学习这两种语言可能会感到困惑,请立即学习 C++。你不想危及你的成绩。

Later, toward the end of the semester or after it, take a few days to learn Java as well. It's no big deal. Once you know C++ it will be easy and quick to learn Java. And you have something to look forward to: Java has cleaner syntax and is easier to understand (no pointers etc).

之后,在学期末或之后,也花几天时间学习 Java。这没什么大不了的。一旦你了解了 C++,学习 Java 就会变得容易和快速。而且您有一些期待:Java 具有更清晰的语法并且更易于理解(没有指针等)。

回答by Nemanja Trifunovic

100 Java to 1 C++? I just searched at dice.com and it returned 9322 for Java and 4777 for C++. Granted, Java is more in demand but the ratio is close to 2:1. Besides, there is also the "supply" side of the equation - there are more Java programmers competing for the positions.

100 个 Java 到 1 个 C++?我刚刚在 dice.com 上搜索,Java 返回 9322,C++ 返回 4777。诚然,Java 的需求量更大,但比例接近 2:1。此外,还有一个“供给”方面的问题——有更多的 Java 程序员在竞争这些职位。