Why JAVA?

Source: Internet
Author: User
Why?Java?

You may know thatJava is an computing platform, not an island of coffee or Indonesia. In the past five years after the birth of Java technology, Java has become a widely spoken term. Some of the statements are true and exaggerated. You may want to know: you should not learn java. The answer I gave you is yes. Please listen to me.

What is Java?

You must first understandWhat is Java? When people mention "Java", they may refer:

  1. Java ProgramLanguage: a similar C ++ Or Smalltalk Object-oriented programming language. Learning Java Programming languages are similar to human languages. They all have a set of rules and grammar.

  2. Java Virtual Machine ( JVM ): Used for execution Java Program. JVM There are many platform versions, such Linux And Windows . With JVM , Java The program can be executed on different platforms, that is, the so-called "write once, can be executed everywhere 」.

  3. Java APIs(It refers to the programming interface of the Library): It is a set of pre-defined classes that can be directly used in your program. These features are free of charge, including file access, network read/write, and graphic interfaces.

When people mention "LearningJava. You may not know much about JVM. Although you have a basic understanding of JVM, it is helpful to learn Java.


Object-Oriented Programming

object-oriented programming has been widely accepted, surpassing traditional programming. Object-oriented programming brings a lot of extra power, but the object-oriented learning curve is steep. If you already know a set of object-oriented languages, it is much easier to learn JAVA.

if you do not understand object-oriented programming, you have to go through a long journey. For myself, it took me about four years to understand the essence of object orientation. However, in the past four years, my learning has been quite fun. If you are in a good teacher's class, or are embedding a pile of good books, it may be enough to shorten it to a few months. Never ignore the learning of object-oriented concepts, because JAVA syntax is good, but it is not easy to write a good object-oriented program.

LearningSome of the reasons for Java are technical, while others are non-technical. I will first describe the characteristics of two programs (garbage collection and exception handling), and then I will tell you why Java is almost a required skill in the field of programming. I will also tell you the information about Java development tools and their attractive prices.

Thank you! It's really good to have "Garbage Collection!

UseC ++, you may accidentally write the program on the machine; If Java is used, the situation will be quite different. The number one bug in the C ++ program is the memory configuration error. C ++ programmers have worked very hard and must directly configure a piece of memory. When this piece of memory is not used, they must also take the initiative to return it. This sounds simple, and it is not easy to do, So C ++ programs often run out of memory.
Java is different. Although you still need to actively configure the memory, the memory will be automatically released once it is no longer in use. This is called "Garbage Collection )」. The garbage collection mechanism makes it much easier to write programs. Although the execution efficiency is slightly lower, the impact may be slightly less noticeable.

Exception Handling Mechanism makes programs more stable

No matter what programming language, you can easily write bad programs, but useIt is not easy to write bad programs in Java. One of the reasons is garbage collection, and the second reason is "Exception Handling Mechanism 」. A program written by a good programmer should remain normal when some unexpected situations occur. The file cannot be opened. What should I do? What should I do if something goes wrong when I read half of the file? If you use C ++ or other languages, you may neglect to handle these unexpected situations. You may argue: "I'm just trying to see if this works. I will go back and extend the program later 」. But the result is usually: after the program runs normally, you will be busy writing new programs. After that, you forget to look back at the incomplete part. After all, the problem will continue to emerge, and you still have to face the mess.
Java forces you to be prepared for any possible problems. Java method can throw exceptions to notify callers of program exceptions. This is a good mechanism. Even if your program wants to open the file, you must write the Exception Handling Method in the program.

EverywhereJava

EverywhereJava, which is a major benefit. If you rely on writing programs for a living, you may be exposed to Java sooner or later. Java has gradually penetrated into various fields. You can write a Java Servlet and link it to Apache or other Web servers. You can write a Java Applet and execute it on a Web browser. You can even write the database Stored Procedure in Java and install it on Oracle 8i.
I bet there will be more and more colleagues using Java around you. Since 1997, many universities have replaced C with Java as the language for programming teaching. In this way, Java becomes a common language for programmers. If the only benefit of learning Java is convenience for communicating with colleagues, it is also worth it.
Finally, I want to mention: "write once, it can be executed everywhere 」. Earlier versions of Java (1.0 and 1.1) cannot be fully cross-platform, but now it is much better. If you want to spread a program to multiple platforms and do not want to rewrite most of the programs, Java is an excellent choice. Java 2 can now be executed on Linux, many UNIX, and windows.
MacOS 9 Java is still in the 1.1 era. However, Apple's next-generation operating system OS X is centered on UNIX, which greatly simplifies the process of porting software. I don't know what Apple officially said, but in March this year, I saw that OS X developer Release 3 was running Java 2. I am confident that Java 2 can be executed on Linux, OS X, and Windows. This covers most of the computer world.

Java free

Sun provides Java-related tools for you to develop and execute Java programs. You do not have to pay the authorization fee, and you do not have to pay for Java development tools. Of course, Sun has its own wishful thinking. Scott mcnealy (Sun's boss) can't want to conquer the world, but in any case, we do not have to pay anyone to enjoy Java.
Moreover, Java APIs are a precious treasure that allows us to easily write powerful programs. Want to write a network program? You already have an API! Want to connect to the database? You already have an API! Want to write a GUI program? You already have an API! Or do you want to perform digital image processing, music file processing, string profiling, and digital signatures? You can use APIs! As a programmer, there are so many easy-to-use APIs that are really just a pleasure. These Java APIs allow us not to "re-invent the wheel", saving us a lot of effort. Java has such a wide range of standard and advanced APIs, which makes C ++ programmers jealous. C ++ programmers often spend time learning C ++ class libraries (for example, MFC), and then go to Linux to learn another set (because there is no MFC on Linux ). Once you have learned a Java API, it will not change everywhere and you do not need to re-learn.
Finally, Java information files can be obtained free of charge from the website. If you have a network and are available, you can learn object orientation, Java language, and Java API through the network. Sun has put a lot of excellent online teaching materials on the website. If you are used to reading books and learning, there are a bunch of Java books on the market for reference (for example, learning Java I wrote ).

Sunbathing

JAVA is much more interesting than other languages. The Java programming language has many "Sticky defense devices" that prevent you from making big mistakes in the program, so you can write the program quickly, and it takes more time to use other languages. An interesting piece of information shows that writing a program in Java is four to ten times faster than using other languages. I know it sounds incredible, but you can ask people around you who know Java. You don't have to spend a lot of time looking for bugs, which means you can take a longer rest on the beach, which means you can sunbathe in the sun instead of "sunbathing on the screen 」. Use Java to buy one pair of sunglasses for the silver pair you earned!

author: Jonathan Knudsen (book on "Learning Java" and "Java 2D graphics")
: cai xuexiao

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.