This section is a general overview of programming with the Java language. It introduces the the Java Virtual Machine, Garbage Collection, Security Features, and starts you on your Java programming journey with the humble “HelloWorld” application
Section Objectives
- Understand the key features of the Java Language
- Understand about the Java Virtual Machine (JVM)
- Describe how garbage collection works
- Discuss the concepts of Classes, Packages, Applications and Applets
- Write, compile, and run a simple application and applet
- Use the online documentation to identify Java classes, fields, and methods
What Is Java
Java is a high-level programming language that lets you write programs that you can embed in the web pages (known as applets), as well as programs that you can run normally on any computer that supports Java (known as applications). You can also write programs that will run both as applets and applications.
The most important characteristic of Java is that it was designed from the beginning to be machine independent. Java programs will run without any change on any computer that supports Java.
The next most important feature of the Java is that it is object-oriented. The object-oriented approach to programming is also an implicit feature of all Java programs.
Apart from the above Java is also Robust, Secure, Multithreaded, Dynamic and Distributed. We will go into more depth into each of these as we progress through the course.
Java was created from a number of languages (the Java team took what they considered the best features) and left out some of the worst. For example, Java doesn’t allow you to work with pointers (although a pseudo-pointer can be used as we will discover later), it has automatic memory management or garbage collection, and because it is Object-Oriented, it is easier to visualize and model problems in a real world sense.
Other features of Java are:
Easy to learn: Although Java is a powerful object-oriented language, it is easy to learn, especially for programmers already familiar with C or C++.
Write less code means faster program development: Comparisons of program metrics (class counts, method counts, and so on) suggest that a program written in Java can be four times smaller than the same program in C++. Therefore your development time may be as much as twice as fast versus writing the same program in C++.
Write better code: The Java language itself encourages good coding practices, and its garbage collection helps you avoid memory leaks. Java's object orientation, its JavaBeans component architecture, and its wide-ranging, easily extendible API let you reuse other people's tested code and introduce fewer bugs.
Avoid platform dependencies with 100% Pure Java: By following the purity tips mentioned throughout this course and avoiding the use of libraries written in other languages, you can keep your program portable.
Write once, run anywhere: Because 100% Pure Java programs are compiled into machine-independent bytecodes, they run consistently on any Java platform.
Distribute software more easily: You can upgrade applets easily from a central server. Applets take advantage of the Java feature of allowing new classes to be loaded "on the fly," without recompiling the entire program.
Java is “easier” to learn than, say, C++ but is certainly more difficult than languages such as Basic. Nevertheless, after this course you will find working in Java easier than tying your shoelaces (well, almost!)
No comments:
Post a Comment