Introduction
This book offers a step-by-step approach in learning Java programming through actual examples and screenshots of codes done in Java language.
The Java Programming Language was first built in 1991 by five employees of Sun Microsystems Inc Ed Frank, Mike Sheridan, Chris Warth, James Gosling and Patrick Naughton. Their idea was to build a programming language, which can be used on different platforms and could create embedded software that can be sued for consumer electronics. During those times, C and C++ were the accepted programming languages. However, these are not efficient for consumer applications. These languages also rely on their platform as the programs written using them should be compiled first for certain hardware before they become useful.
Below are the primary features of Java:
Simple - Java doesnt have sophisticated features such as operator overloading, multiple inheritance, memory allocation, and pointers.
Safe - Java features a virtual firewall in between the app and the PC. The codes written in Java are limited within the Java Runtime Environment that doesnt allow prohibited access.
Portable - You can run Java codes on any platform or any machine. Java codes are portable as the byte code can be transmitted to any operational platform.
Platform Independent - In the compilation phase, a program written in java is transformed into a byte code that can be used to any platform Windows, Mac/OS, or Linux. Hence, you can still use a program, which has been compiled on Mac/OS, on Linux and the other way around.
Multi-threading Java allows a program to do numerous tasks simultaneously
Object Oriented Java can organize the programs as a bunch of objects, which can represent a class instance.
Distributed With java programming, it is easy to create applications that can be distributed. You can use a Remote Method Invocation (RMI) or Enterprise Java Beans to develop distributed apps through the Internet.
Robust Java can handle memory management glitches as well as runtime errors efficiently.
Take note that this crash course is just a beginning of your journey towards exploring the wonderful world of Java programming. This popular programming language is more than the technicalities and programming that supports it. This also involves helpful libraries, which can help you in creating amazing programs.
Chapter 1 Java Fundamentals
Changes in the computing world and improvements in the science of programming are the two factors that drive the computer language forward. These two factors also affect the innovation of Java programming. Establishing upon the dynamic legacy of C and C++, Java introduced features and refinements, which mirrors the present state of the programming world. As a response to the emerging web environment, Java has features, which streamline programming for an architecture for high distribution.
Java, C and the C++
Before going any further, it is important first to know the relationship between Java and C/C++. Java is considered as a descendant of C and C++. Java based its syntax from C, while its object model was patterned after C++. Many programmers have been using the syntax of C/C++. This makes it easy for a programmer to learn Java as there is already background information and skills.
Java became popular mainly because it improved an already effective programming structure. C initiated modern programming. It evolved to C++, and now Java. By building upon this rich heritage, Java offers a programming language that is powerful, logical, and takes the best of earlier languages and offers new features that are adaptable for the online structure.
Because of the common elements found on these three languages, it is easy for a professional programmer to switch from one language to another.
A key design philosophy of C and C++ is that you, as a programmer, is in command. This is also true in Java. Except from the limitations of the online world, Java provides you with complete control. Your program will reflect your skills. Even though it is an easy-to-learn language, Java does not have training wheels, it is a language for professional programmers.
Some people consider Java as the internet version of C++, mainly because of the similarities of Java to C and C++, particularly their accessibility through object oriented programming. This is not true. Java still has differences when it comes to philosophy and practical application.
Even though Java was inspired by C++, it is not an improved version of C++. First, it is not downwardly or upwardly compatible with C++. In addition, Java was not created to replace C++. Instead, Java was developed to solve specific problem sets, while C++ was also developed to solve different problem sets. Java doesnt compete with C++. C++ and Java will continue to be used as separate programming languages.
Java and C#
Several years after the development of Java, Microsoft introduced C #. This is crucial because C# is relevant to Java. As a matter of fact, most of the features of C# is parallel to Java. Java and C# are both founded on the standard C++ syntax, uses the same object model, and provides support for distributed programming.
Of course, there are differences between C# and Java, but the general interface of these two programming languages are quite the same. Hence, if you are familiar with C#, then it will be easier to learn Java. On the other hand, if you are familiar with Java, it will be easier to learn C#.
But C# will not replace Java, because these two are optimized for two distinct types of computing platforms. As Java and C++ will coexist for more years to come, so will Java and C#.
Significant Contributions of Java to the Internet
The Internet greatly helped in the popularity of Java, and conversely, Java had a crucial contribution on the Internet. Aside from streamlining online programming as a whole, Java also developed a new kind of networked program known as applet, which transformed the manner that the internet world consider content. Java also resolved some of the most important concerns about the Web such as security and portability.
Java Applets
Java applets are special types of program, which are developed to be carried over online and instantly applied by an online browser that is enabled with Java. Moreover, Java applets are downloaded depending on the demand, without complicated user interaction. Once a user access a link, which has an applet, the computer will instantly download the files and execute the download codes. Applets are designed to be minor programs. These are usually utilized to display information from the server, deliver basic functions, and manage input from the user.
Applets development transformed the online programming as this widened the range of objects, which can move easily in cyberspace. Generally, we have two wide object categories that are channeled from the user to the server such as programs that are passive, dynamic, and active.