Java 有什么好处?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/242225/
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
What are the benefits of Java?
提问by Sophie
I always hear that programmers try to pick the right tool for the job. I've never programmed in Java, so I was wondering What are its benefits? Why is it so popular? What should I use it for?
我总是听说程序员试图为工作选择合适的工具。我从来没有用 Java 编程,所以我想知道它有什么好处?为什么如此受欢迎?我应该用它做什么?
I just program recreationally. Is there anything about it that makes it particularly fun??
我只是休闲地编程。有没有什么让它特别有趣的地方?
回答by Greg Hewgill
I think after 12 years or so, the "write once, run anywhere" mantra is almosttrue. Writing Java code pretty much isolates you from the platform dependent aspects of the systems on which you deploy it.
我认为在 12 年左右之后,“一次编写,随处运行”的口号几乎是正确的。编写 Java 代码几乎可以将您与部署它的系统的平台相关方面隔离开来。
回答by erickson
- Portability
- Incredible breadth of libraries
- Bottom-up security
- Performance
- Robustness
- 可移植性
- 令人难以置信的图书馆之广
- 自下而上的安全
- 表现
- 稳健性
回答by Mark
Massive communities, the amount of help, libraries, IDE's, is huge (and thats a good thing).
庞大的社区、大量的帮助、库、IDE 是巨大的(这是一件好事)。
回答by Adam Liss
For a casual programmer Java can teach a lot about object-oriented programming, and encourage good programming habits in general, without the need to worry about as many of the "messy" details (pointers, memory management) as, say, C++.
对于一个普通的程序员来说,Java 可以教很多关于面向对象编程的知识,并鼓励良好的编程习惯,而无需像 C++ 那样担心许多“凌乱”的细节(指针、内存管理)。
It's also a bit easier to debug "catastrophic" errors.
调试“灾难性”错误也更容易一些。
回答by Walter Rumsby
Java is really goodat integration - there are specifications and implementations for integrating with many kinds of systems that you're likely to run into in an "enterprise" environment.
Java非常擅长集成 - 有一些规范和实现可以与您可能在“企业”环境中遇到的多种系统进行集成。
It's not really a "fun" language relative to popular high-level languages.
与流行的高级语言相比,它并不是真正“有趣”的语言。
回答by Jon Skeet
This seems to be getting healthy answers, but you might also want to look at "Why do people use Java?"
这似乎得到了健康的答案,但您可能还想看看“人们为什么使用 Java?”
回答by dongilmore
Java is a good language, but that is secondary to the importance of the standard library that comes with it. The jdk may not be the most elegant kit ever built, but it is extensive, powerful and reliable. Programming in Java the language is simple. Programming with appropriate reuse of the jdk is what it is all about.
Java 是一种很好的语言,但这与它附带的标准库的重要性相比是次要的。jdk 可能不是有史以来最优雅的工具包,但它是广泛、强大和可靠的。在 Java 语言中编程很简单。通过适当重用 jdk 进行编程就是它的全部内容。
回答by OscarRyz
Cross platform is in my opinion the most relevant benefit.
在我看来,跨平台是最相关的好处。
The main goal of Java was to create a programming language that could run anywhere. The target was GUI apps. This however never happen because the environment was too slow at the beginning ( now it has been improved ) but it prove true in the server side where the cost of development reduced a lot because the product development can be done in PCs and the deployment in very expensive hardware.
Java 的主要目标是创建一种可以在任何地方运行的编程语言。目标是 GUI 应用程序。但是这从来没有发生,因为一开始环境太慢(现在已经改进了),但在服务器端证明确实如此,开发成本降低了很多,因为产品开发可以在PC上完成,部署非常方便。昂贵的硬件。
It brought easy of development also, because it was designed to have C++ like syntax but running on a virtual platform to avoid platform specific code. At first the penalty was the execution speed, because it was interpreted, but release after release the interpreters became more and more faster that even MS model its next generation of development after java and call it .net
它还使开发变得容易,因为它被设计为具有类似 C++ 的语法,但在虚拟平台上运行以避免特定于平台的代码。一开始的惩罚是执行速度,因为它被解释了,但是一个版本一个版本的解释器变得越来越快,甚至 MS 也模仿了它在 java 之后的下一代开发并称之为 .net
AdditionallyYou can have a read of the Java design goals here
此外,您可以在此处阅读 Java 设计目标
回答by Mnementh
I want to add one point: Java keeps a good compatibility to earlier versions. That means, your Java-projects are compile and run in most cases without any problem on newer versions. That seems to be a little point, but this stability in API's and language helps to build a big community around Java, including good tool-support.
我想补充一点:Java 与早期版本保持良好的兼容性。这意味着,您的 Java 项目在大多数情况下都可以编译和运行,在较新版本上没有任何问题。这似乎有点问题,但是 API 和语言的这种稳定性有助于围绕 Java 建立一个大型社区,包括良好的工具支持。
Others already mentioned other important points:
其他人已经提到了其他要点:
- good portability
- lot's of libraries for nearly anything
- easy debugging and easy to catch problems
- 便携性好
- 许多图书馆几乎可以满足任何需求
- 容易调试,容易发现问题
回答by prasanna
oop provides like encypsilation ,inheritance,polymorphism not available in traditional programing .oop is closer to real life presentation of the programming 1. Relation ships can be representation using inheritance 2. Programme developement become easy due to increased modularity
oop 提供了传统编程中没有的诸如封装、继承、多态性等。oop 更接近于编程的现实生活呈现 1. 关系可以使用继承来表示 2. 由于增加的模块化,程序开发变得容易

