Java Cafe (1)--sigh coffee _java programming

Source: Internet
Author: User
Tags garbage collection touch jboss tomcat
Source: Computer Enthusiast Author: Gary Chan

Some say the café is a place where people learn to slow down and enjoy life. That's a reasonable remark. Hong Kong people often call coffee drinking "sigh coffee", this "sigh" word has appreciation, taste the meaning of the comfort of the environment, nature is to attract customers. Although Hong Kong inch Jin Yu soil, but no matter in the city or in the scenic area, it is not difficult to find exquisite elegant café, they or with a European feelings, or rich British style charm, most beautiful environment, decoration, seat comfort, style extraordinary.

I. Preamble

Many people want to learn programming, but do not know where to start. In this series, I will introduce you to Java programming technology, as well as Java program development methods, starting from scratch, step-by-step, hoping to let you personally taste Java this coffee mellow and rich.
If you read this series you will be able to fully master the Java technology, I would not dare to make such a guarantee. Drink more coffee, I can not take the profound Java condensed into a serial. The café is a place of leisure, so I will selectively introduce you to an important part of Java technology, but not all of it is very deep. So, if you want to be truly proficient in Java technology, you also need your own efforts and sweat. After all, the coffee smells fragrant, but itself is bitter, only do not abandon this bitter, can taste the real taste.

But you don't have to consider this serial as a traditional tutorial. Java technology from the advent of today, has been nearly 10 years of history. As Java technology grew, countless heroes emerged, helping Java technology create epic glories. In this Java café, we also prepared a lot of interesting biographies or stories, called the "Yellow sugar story." Originally, programming is creating, in itself there is endless fun.

Welcome to http://garychan.3322.org/exchange experience, and put forward your request and hope for this serialization.

Second, what is Java

Perhaps you would interpret Java as Indonesia's Java island, the center of the early Indian-Javanese culture, rich in sour Arabica coffee. In the computer industry, however, as soon as a mention of Java, people's nerve cells will be immediately excited, because Sun's Java technology is very hot!

First you should understand what people mean by Java. First of all, if you are a beginner, some of the following term will inevitably let you Da Guo. I want you to be patient and try to understand, because these nouns can be quite helpful for you to understand and love Java.

When people talk about Java, they may refer to one of these concepts:

★sun the Java programming language of the company, an object-oriented (object Oriented,oo) programming language. The Java language is a derivative of computer languages such as C + + and Smalltalk. Learning the Java language is similar to learning a natural language (such as English) grammar.

★java Virtual Machine (Java virtual MACHINE,JVM). Programs written in the Java language run on virtual machines, and Java virtual machines are the middle tier between Java programs and operating systems, so Java programs can run on all electronic devices that support Java virtual machines (note, not just personal computers, but also electronic devices including mobile phones, PDAs, and information appliances). , and does not require any additional operations, which is unmatched by other computer languages. The Sun Company's slogan is "Write, run Everywhere", the Java Virtual machine is the cornerstone of this slogan.

★java application Programming Interface (application Programming Interface,api). The Java API is a predefined function that is made available to programmers, such as disk reads and writes, network calls, drawing graphics, and so on. If you compare the Java language to the grammar of a natural language, then the API is a book full of good couplets, which helps us to write more conveniently without having to write everything from scratch.

Application of ★java technology. Wow Your phone supports Java! Or RPG game?! Play for me, or ... "Yes, because of the creative advantages of Java language, but also industry standards, so by the major enterprises in pursuit of a wide range of applications." Please refer to section III for more information.

The story of the Yellow sugar

  Object-oriented (Object Oriented,oo)

The object-oriented programming mechanism in Java and C + + language is considered to be another major step forward after the C, Fortran and other procedural languages. With OO development software, the program will be simpler and more robust, so oo is by far the most successful programming mechanism. In fact, Smalltalk is the first fully object-oriented dynamic computer programming language, Smalltalk, the inventor of Alan Kay April 19 This year also won the 2003 "computer science Nobel" reputation of the ACM Turing Award. It is worth mentioning that Alan Kay, who was a professional musician before joining the computer industry, was famous for his colorful speeches.

The learning curve of OO is steep, so if you already have other OO languages, learning Java is a lot easier, or it's going to take a little more effort. If you are not in touch with OO, there is no need to worry, we will slowly touch oo in the tutorial. However, do not quit and skip the important part of OO. Learning Java syntax is easy, but writing authentic OO code requires a considerable understanding of OO.

Third, the attractive Java technology

First, let's talk about Java technology. It needs to be explained that, unlike the computer languages commonly heard or used in C, C + +, Visual Basic, Delphi, Java technology refers specifically to the application, not the Java language.

Anyway Java technology is the technology that helps you to experience interconnection and enjoy interconnection. Since Sun Microsystems invented Java in 1995, Java technology has been widely used in a variety of devices, providing you with a variety of tools, information and fun games (see Figure 1).

  1. Commercial Applications

Java technology means business opportunities. Java technology can run on almost all types and sizes of devices, small to computer chips, cellular phones, large to supercomputers, ubiquitous.

More than 150 million of mobile phones are integrated with Java technology, and Java technology is also used in PDAs and pagers; video games consoles, televisions, web sites, and so on, are also the beneficiaries of Java technology, with PCs pre-installed on the Java platform (the latest Mac OS X is finally able to support Java). Linux has always supported Java. Windows originally supported Java and had legal contracts with sun, but when Bill Gates discovered that Java technology was a serious threat to Microsoft's own technology, it quietly revoked the integration of Java technology in Windows XP. Of course, this clumsy method was quickly discovered, Microsoft was sued by Sun, and had to pay a large sum of the breakup fee, and finally legally to make the conspiracy to succeed. It is a sigh to dare to face the dismal competition. Therefore, Windows XP users need to install Java Runtime to be able to use Java technology, even the red Planet has the use of Java technology.

The story of the Yellow sugar

  Java technology and the Red Planet

  When scientists finally confirmed the successful landing of the "Spirit" probe, the Earth people cheered up: "This is a great initiative!" ”

In the Jet Propulsion Laboratory at the National Aeronautics and Space Agency, Calif., the father of Java, Dr.--james Gosling, must have felt like he was at home, because he was surrounded by sun workstations. "This is obviously the coolest thing in Java apps so far!" "The Java application allows the public to watch and download the images of Mars in real time," Dr. James Gosling said in great praise. It allows people to see clear three-dimensional images of Mars, as well as a mock detector. ”

This Java application is called Maestro. Java technology has brought NASA a simple, low-cost way to manipulate the "courage" number. Sun Labs and NASA's Jet Propulsion Laboratory are also collaborating on a Java-based control system that will enable future cosmic probes to intelligently and independently make decisions when exploring the red planet.

Relying on Java technology and Sun's server technology, Sun has also formed alliances with many leading enterprises in the computer industry to build advanced and reliable operational systems to help businesses, governments and educational institutions to communicate and collaborate more conveniently and effectively. For example, the PICC's E-commerce system was formed by Sun and Oracle (a well-known database company) and Bea (a well-known middleware company). The Swiss bank, the Italian mint and so on have all adopted Java technology.

In fact, many of the brands around us are partners in Java technology, such as Fuji, HP, Motorola, Nokia, Panasonic, Siemens and so on. You can find a long list on Sun's website.

  2. Mobile Communication

Do you remember the days when your phone was only for phone calls? Thanks to Java technology, mobile phones that support Java technology are becoming more customizable, and mobile gaming is becoming more appealing.

Using the latest Java technology of mobile phones, you can browse the list of applications, games, services, and then direct wireless download, that is, installed, no longer because the mobile phone integration fixed several games and tired of playing. With the continuous release of game or software companies, you have new games to play every day, and new software is available.

3. Desktop applications

Java technology makes personal desktop computers more interesting and interactive. Windows? Mac OS? Linux? It doesn't matter that a program that uses Java technology can run on any operating system! At the same time, Java technology can also provide from the networking of role-playing games to market tracking applications, readily available.

The Java Desktop system (Sun Java Desktop System) is the sun's new generation of Java technology-based Desktop systems, combining the best open-source software driven by Sun technology, such as the GNOME desktop environment, StarOffice Office suite, Mozilla Browser, Evolution Mail and Calendar client, Java 2 platform Standard Edition, etc., is an integrated management tools and development tools, easy to manage, highly secure desktop Customer system, the goal is directed at Microsoft's Windows+office System suite. There is no doubt that the Java desktop System's low price, excellent security and complete business functions are the weaknesses of Microsoft's system. For the next generation of desktop systems, Sun also launched an advanced project called Looking Glass. What would you experience if the form was transparent and stereoscopic so that you could manipulate multiple forms at the same time? Add your comments to your current browsing page at your own whim? Does your CD or movie Database turn into a 3D jukebox (Figure 3)? In the near future, sun will incorporate such innovations in the Java Desktop system, giving users a richer experience of using them.

  4. Developer

  For the convenience of developers, Sun distinguishes Java as J2SE (Java 2 Standard Edition), Java 2 Enterprise Edition, J2ME (Java 2 Micro Edition), and Java Card four kinds of platforms. J2SE is the foundation of all Java technologies, and no matter what platform Java Applications developers are developing, they must first learn from J2SE. Java EE technology is focused on the application of enterprise Server side. J2ME mainly for embedded systems, including mobile phones, PDAs and so on. Sun also offers free J2ME Wireless Toolkit for the development of mobile apps. Java card technology is used to develop applications that can be implanted into IC smart cards.

The software development kits for the above four platforms (Software Development KIT,SDK) are free and can be downloaded from Sun's website. Of course, using only the SDK is too much of a stress, we need to develop tools to improve development efficiency. Such tools are called integrated development environments (integrated Development environment,ide). In the past, the two Ides of Borland JBuilder and IBM eclipse were most favored by Java programmers, while Sun's own Ides were obscure. After 2004, Sun placed its IDE in an important position to push for the development of NetBeans and Java studio. The former is an open source tool that is written entirely in Java, while the latter is a heavyweight official development tool. Sun's development tools are the root of the red, Java programmers can finally Bath Sun (Sun) Shine!

Java Café Main and J2SE deal with, of course, will not skip the knowledge of Java EE and J2ME, worth looking forward to Oh!

Iv. advantages of the Java language

Although the Java technology is so tempting and the foreground seems very bright, is it already a widely used and successful language, such as C, C + +? Microsoft is not aggressively promoting them. NET technology? Are the artificial intelligence languages such as LISP, Prolog and so on in the financial field of North America and Europe not also a big application? Is it a wise choice to learn Java programming?
With these questions, let's look at the advantages of Java.

  1. Free!

Sun provides everything you need to develop Java applications for free, and you don't have to pay any royalties. Maybe you'll be skeptical: capitalists are doing communist? In fact, Sun's benefits in Java are really small, far more than IBM and BEA, which monopolize Java Application Server technology, seem to be making wedding clothes for others. In this respect, Sun Chairman, president and chief Executive Officer Scott McNealy explained: "Sun does not use Java to make money, this is like using English without taxes, sun does not use Java itself to profit, but to apply Java to the business." "The original is long leash there!"

Java APIs are a valuable and free asset compared to Java itself. Want to use socket operation network? In the API, want to connect to the SQL database? API, and want to give the application a nice user interface? In the API, want to work with digital graphics, play music, parse strings, or create digital signatures? It's all in the API.

Finally, Java has developed for so many years, excellent Java tutorials, technology sites countless. Sun itself offers free tutorials, enough for self-study. You can download this tutorial in http://java.sun.com/docs/books/tutorial/information/download.html. Bruce Eckel Master's Masterpiece Java Programming ideas (thinking in Java) is a great book to read, and many enthusiasts even think of it as a Bible page. You can download the electronic version of this book for free at the author's homepage http://www.BruceEckel.com. The machinery industry press has also introduced a Chinese version of the Taiwanese technology writer Hou Jie, but it is not free.

Perhaps you would ask, with so many excellent tutorials, what are you doing in this Java café? Well, while those tutorials and technical articles are so good, they're not for beginners. The purpose of the Java Café is to help you lay the groundwork for Java technology, master the main threads of Java technology, and help you take the first step into the Java world!

  2. Cross-platform

"Write once, run anywhere," the Java system can run on different operating systems and hardware. As Linux continues to grow and Mac OS X fully supports Java technology, Cross-platform features become more and more weighty.

Because Java is cross-platform, the Java API is naturally platform-unified. For programmers, there is no more comforting than a unified API function--there's a round wheel, so why invent the wheel from scratch? We can see the value of Java APIs compared to C + + class libraries. C + + programmers with experience in Windows programming must have experienced the days of being tortured by MFC (Microsoft Foundation Classes, Microsoft Base class), the steep learning curve, the inability to start production for a few months, and the high rate of forgetfulness over time. It is said that even within Microsoft, no one is willing to use it except for the MFC development team. Even if you are familiar with MFC, can successfully develop Windows applications, if you want to write a Linux application, MFC is not useful, you have to learn Linux under the C + + development of a set of library functions. There are also Unix, FreeBSD, Mac OS ... Did you learn to come? Anti-Java API, operating system, you love who is who, as long as the writing can be run anywhere!

  3. Strong support has been gained in academia

Because of the free, Cross-platform, Java language itself technologically advanced, in colleges and universities, Java has become a number of subject research, curriculum and calculation of the preferred language, with Java to do on the machine, is generally encouraged. As far as I know, the postgraduate entrance examination of many faculties of Peking University and Tsinghua can be answered in the Java language. In fact, using Java to do this is much simpler than using C or other languages, and you can focus on the core parts of the algorithm to get a higher score.

Master Java Technology students generally have more job opportunities after school part-time, get a higher pay, not only to reduce the burden of the family, but also allow themselves to enter the social exercise as soon as possible. So, if you are still studying, learning Java, you must be right.

  4. Simple

  Syntax Java is simple compared to languages like C + +.

Thankfully, Java provides a garbage collection mechanism. In the past, the development of C + +, the most easily wrong place is memory management, the application of the memory must be released after use, otherwise can use less memory resources, until the exhaustion of system resources and cause panic. In the Java system, you can apply any memory, and the Java system will automatically release the unused memory resources when appropriate. This magical mechanism called "garbage collection" saves a lot of time for debugging errors.

In Java, it's not easy to write poorly coded code. On the one hand, the garbage collection mechanism blocked the possibility of memory leaks, on the other hand, the exception capture mechanism, it forced you to do the worst. When you write a program, you will inevitably encounter some unexpected, such as file can not open, network read failure and other special circumstances. In C + + and other languages are based on the return value to judge, if a sentence to check the return value, it is too much trouble. As a result, programmers habitually ignore the return value of the check and comfort themselves that everything will be okay. This will bury the hidden danger. In Java, Java methods can throw exceptions, and you have to answer exceptions even if you don't want to do anything. For example, write the code to open the file, you have to respond to exceptions to prevent accidental occurrence, otherwise the program simply can not compile. Proactive, making the Java system more robust.

  5. Mature Platform for enterprise application

This is one of the two most active areas of Java technology today. We have already mentioned a lot in the previous Java technology Introduction, and here we focus only on the advantages that are relevant to us.

Java Technology enterprise applications are designed to enhance the competitiveness of enterprises, so the Java technology is appreciated by enterprises, market share is the largest of the same technology. At the same time, Java open standards, so many vendors. There are many application servers, tools and artifacts available, ranging from high-end Bea WebLogic, IBM WebSphere and other commercial software to open source free tools such as Tomcat and JBoss. As a beginner of Java technology, it is possible to do the training of Java Enterprise application without any cost, and then, if you participate in the development of Java Business Projects, you can seamlessly migrate the software to high-end commercial platform. In view of. Net, want free self-study, do not pirate is impossible.

Finally, talk about Java and Web services. Web services are a milestone in the history of software interoperability, an important direction for technology development, and a technology that you must never fail to understand. Sun is the inventor of the Java language, and as an open Cross-platform technology system, Java plays a very important role in the development of Web services. As an active participant and leader of the industry, Sun was accepted as a member of the Web Services Interactive organization WS-I, and the promotion of Web services interoperability was significant, as well as a key counterweight to the value of Java technology.

  6. Wireless Applications

This is another of the most active areas of Java technology that are designed to provide more and more convenient personalized services for Java mobile applications. In the coming years, there will be huge business opportunities and fierce competition between mobile communication operators and mobile device applications, and this trend is likely to interact with other developments such as e-government, E-commerce and so on. The proprietary nature of Java in the handset market and the openness and standard of Java itself make more and more enterprises join the Java camp.

China is no exception. The first time Dr. James Gosling came to China in 2003, one of the important tasks was to forge alliances with China Unicom.

The story of the Yellow sugar

  Dr.--james Gosling, father of Java

Dr. James Gosling is famous for "the father of Java technology". He is the founder of Java Technology, as a member of the Sun Research Institute, personally designed the Java language, complete the Java technology of the original compiler and virtual machine. Under his leadership, Java has become the standard programming mode of Internet and the fact standard of distributed enterprise application, and its Cross-platform technical superiority has brought about epoch-making change for network computing. At present, Dr. Gosling is actively committed to the research of software development tools to make software development tools more powerful, easier for developers to use, to ensure the rapid implementation of application, service development.

In fact, mobile game development is also a good career and opportunity, the success of a number of examples oh.

  7. The Open Java Community--java Community PROCESS,JCP

JCP is a hero who makes Java famous. JCP created an open forum for like-minded enthusiasts to exchange views, explore and define new platforms and brainstorm. Java welcomes competition, because only in this way can the maximum increase in the field of technology, this with rival Microsoft. NET technology is vastly different. There are many actors on the Java stage, anyone can participate in the process of JCP, help Sun to determine the development and future of Java, but also challenge their influence. As a result, you can find that new nouns in the Java world abound, far ahead of the norm. and at Microsoft. NET technology on the stage, you can only see an actor, that is Microsoft itself.

  8. Support from open source or non-profit organizations

Open source organization is the dream of anarchy--no polity, no ownership, freedom of speech and action, only sustained by faith and selfless devotion to desire to share and communicate. In the Java World, open source organizations and non-profit organisations are at their best, and many of the finest tools are in their hands. For example, JUnit, Cactus, Tomcat, Struts, JBoss, Eclipse, ANT, Xerces, Hibernate, Axis, AspectJ, and so on, many tools will appear in our café and play an important role.

In the Java world, there is absolutely no good in cheap goods, and these tools have the quality that is comparable to commercial software, and many business Ides also integrate these tools. For Java programmers, life will not only be easy, more importantly, you can see hope, there is a chance to contribute their own strength!

V. Summary

See here, if you can have the impulse to learn Java technology, I also satisfied. It is difficult to choose a language, you must have a choice. Even if you are a staunch Microsoft technology fan, have time to also welcome to sit awhile in this café, sigh a sigh Java this other amorous feelings.

Related Article

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.