JAVA PROGRAMMING-AN INTRODUCTION, HISTORY, AND THE FUNDAMENTALS FOR CREATING YOUR FIRST PROGRAM CHAPTER 1

INTRODUCTION



Congratulations on downloading JAVA Programming: An Introduction, History, and the Fundamentals for Creating Your First Program, and thank you for doing so!

The    following    chapters    will    discuss    the    fundamentals    of    JAVA
programming, its uses, and how to start writing JAVA code for yourself.


There are plenty of books on this subject available on the market, so thank you again for choosing JAVA Programming!  Every effort was made to ensure this book is full of as much useful information as possible. Please enjoy!
CHAPTER 1




An Introduction to JAVA



JAVA is a type of programming language that was designed specifically to be  used  on  the  internet.  It  is  easier  to  use  than  its  counterpart,  C++,  while utilizing a model of programming that is object-oriented. JAVA may be utilized in order to create entire applications that may be distributed among clients and servers in a network, or run on a single computer. JAVA can also be used to build a small applet, or a small application module, to be used as part of a Web page. Applets  enable  Web  users  to  interact  with  that  particular  Web  page.  JAVA programs can be found in mobile devices, desktops, Blu-ray Discs, servers, and smart cards.
JAVA  was  originally  known  as Oak  when  it was  first  created.  Oak  was created  by  James  Gosling  in  the  year  1991.  James  Gosling  worked  for  a company at the time known as Sun Microsystems, and the original purpose for Goslings  programming  language  was to be used in small electronics  such as televisions,  toasters,  VCRs,  and  so  forth.  The  purpose  of  JAVA  since  its beginning was  to  be  fast,  efficient, small,  and  portable.  Sun  Microsystems renamed the programming language and introduced JAVA in 1995. After this introduction, the interactive capabilities of the World Wide Web grew exponentially. A JAVA virtual machine is included in all major Web browsers. Likewise, almost  every  major  operating system  developer has  added  JAVA compilers as a part of what they offer in their products, major operating system developers being companies such as Microsoft and IBM. JAVA is now owned and maintained by a company called Oracle.
So  how  did  the  name  JAVA  come  to  be?  The  name  JAVA  came  into existence when James Gosling, along with his team members, were developing

the  JAVA  language  and  happened  to be  drinking  copiously  high  amounts  of coffee. The JAVA team felt that, because of the large quantity and high quality of the coffee they happened to be drinking, they were then able to better develop a higher quality of a programming language. The coffee that James Gosling and his team were drinking had its own very special role in the development of the JAVA programming language and happened to be distributed to the entire globe from a place with the moniker “Java Island”. Essentially, Gosling and his cutting edge team were inspired to christen the brand new programming language with the  name  of  the  place  where  their  caffeinated  nectar  originated.  Hence,  the symbol for the JAVA programming language is the unmistakable cup and saucer.

The top 10 facts you need to know about Java as you get started reading this book

1.    The term Java refers generally to a trifecta combination of these things: The programming language known as JAVA
The JVM, or JAVA Virtual Machine, which is the JAVA platform. The JVM is what runs Java bytecodes  that have been compiled,  usually calling  on  a  set  of  standardized  libraries  specific  to  JAVA.  These libraries include those provided by the Enterprise Edition, referred to as EE or Java Standard Edition, which is referred to as SE. Though the platform for JAVA and the JVM are designed to work hand in hand, the language  itself  does  not  necessarily  imply  the  use  of JAVA  Virtual Machine, and vice versa as well.
The Java Virtual Machine (JVM) refers to a virtual machine operating at a very high performance  level, and executes  bytecodes  on a very specific computing platform. The JAVA Virtual Machine is abbreviated and is simply referred to by programmers typically as JVM.


2.    The  majority of  the  higher  layers  of  the  widely  used  mobile Android operating system, or OS, is built using JAVA, so it is imperative that you learn JAVA if your goal is to eventually build applications for the Android operating system. With JAVA programming, you are able to build games, embedded systems, websites, and desktop applications, which may have similar versions of those programs on mobile devices and other devices as well.

3.    There are 4 different JAVA platforms available:

The  JAVA  Micro  Edition.  The  JAVA  Micro  Edition  contains  the libraries and frameworks needed in order to build the applications that run on smaller devices, known as micro devices, such as tablets and smart phones.

The   JAVA   Enterprise   Edition.   The   JAVA   Enterprise   Edition   is comprised  of the libraries and frameworks  that are required to build applications which are utilized mostly by enterprises.

The JAVA FX Edition. The JAVA FX Edition is comprised of graphic libraries that are used to operate consistently across a wide variety of platforms and also to build strong client applications.

The JAVA Standard Edition. The JAVA Standard Edition is comprised of  all  of  the  core  JAVA  functionalities  and  all  of  the  core  JAVA libraries. This is the edition that you will be using to learn JAVA programming  from  in  this  book,  and  also  utilizing  when  or  if  you continue to pursue your programming education.


4.    The  JAVA  programming  language  is  an  object  oriented  programming language, referred to by programmers as OOP, and operates on a high level.

5.    The JAVA programs are run on a special dedicated software known as the
JAVA Virtual Machine, referred to as JVM in the programming world.

6.    The  JAVA  virtual  machine,  or  JVM,  is supported  by  a high  number  of operating systems. Because of the fact that JAVA can be run on so many operating  systems,  this  makes  JAVA  a  cross-platform  language.  This  is where the popular phrase “write once, run anywhere”, or WORA, originates from. This term is also sometimes known as “write once, run everywhere”, or WORE.

7.    You will need to download and then install the JAVA runtime environment, also known as the JRE, in order to install the JAVA virtual machine and run JAVA programs. Note that the JRE cannot be used to develop JAVA programs. The JRE can only be used to read JAVA programs.

8.   In order to access the tools necessary to the development of JAVA applications, however, you first need to download and install the JAVA development  kit.  The  JAVA  development  kit  is  also  referred  to  by

programmers as the JDK. The latest available version of the JDK is version
8. However, you will not need to download the JRE if you download the JDK 8 version, because you are able to freely redistribute the JRE in that version with your application, in accordance to the JRE licensing terms.

9.    The acronym  IDE refers to a software  suite that is known as Integrated Development  Environment  and which  provides  the people  who program computers the necessary comprehensive tools needed in order to make software writing, testing and overall development possible. Normally, a modern IDE will be made up of a debugger, a source code editor, and an interpreter or compiler. The software developer utilizes a single graphical user interface, referred to by developers as simply a GUI, in order to access those three tools. There are two very popular JAVA IDEs that are also completely  free  –  an  IDE  known  as  Netbeans,  and  an  IDE  known  as Eclipse.  In  this  book,  you  will  be  shown  how  to  program  utilizing  the Eclipse IDE.

10.   A great resource of learning all about beginning your JAVA programming experience is right in front of you - this book!


JAVA Features

The major features of JAVA are:
 
JAVAs code is robust. This means that the JAVA objects may contain zero references to other known objects, or data that is external to themselves. In contrast, programs written in C++ and other languages do not have this ability. This process makes sure that the instruction does not contain the address of the stored data in the operating system itself, or that of another application. Either of those occurrences would effectively cause the operating system or the program to crash, or terminate. In order to ensure integrity, the JAVA virtual machine, or JVM, has a number of checks in place.

JAVA applets have other features that are in place in order to make it work as efficiently as possible, in addition to being executed not at the server, but instead, at the client.

JAVA is much easier to learn than C++, although the language is certainly not learned overnight.

Programs created in JAVA are portable in a network. This means that these programs can be used in other operating systems than the one that  created   it  without   needing   to  perform   a  complicated,   time consuming, major rework. The source program is compiled into what JAVA refers to as bytecode.  This bytecode  is able to be run in any network on a client or server that has a JVM. That JVM then translates the bytecode to a code which will then have the ability to be run on the actual computer hardware itself, which means that distinct differences in platforms, such as the length of instructions for example, are able to be recognized and dealt with locally - as soon as the program is being executed.  Basically,  JAVA  ensures  that  it is no  longer  necessary  to produce platform- specific versions of your software program.

JAVA programming is what is known as “object oriented”. This means that a single object is able be a part of a group of other objects as well as inherit code which is common to that class, among other numerous features. Rather than the traditional procedural “verbs”, objects are referred to in terms of “nouns” which someone is more likely to relate to. A method may be looked upon as one of the objects behaviors or capabilities.


More about object oriented programming (OOP)

Object  oriented  programming,  referred  to by  programmers  as  OOP,  is a model of language  that is built around data instead of logic, and also objects instead of actions. After the input data is processed, it then gives output data. OOP takes the view of the object of interest to be worked with over the logic that is needed in order to make them work. These objects, for example,  can vary from computer widgets to a building and its floors to human beings.
In OOP, the first step is to locate all of the objects the programmer wishes to
manipulate, and then to identify how these specific objects are able to relate to each other. This process is usually referred to as data modeling. Once a programmer has selected an object to be identified, the programmer would then generalize it. For example, this one particular book would then stand for all books. This generalization defines the type of information that the object holds, as well as the logic sequences which are able to work with it.  Every separate sequence is referred to as a “method”. Objects within OOP communicate with messages, which are interfaces that are clearly defined. The rules, parameters, and concepts utilized in OOP offer these benefits that all programmers need to

be aware of and grasp:
 
The data class concept makes it possible to define object subclasses which have all or at least some of the key group characteristics.  This particular  quality  of  OOP,  called  inheritance,  reduces  development time.   Inheritance    ensures   more   acutely    accurate    coding,   and inheritance also requires a more thorough data analysis.

A  class  defines  only  specific  data.  When  that  object  or  group  is running, the code will not mistakenly  access data from the program that is not intended. This particular conceptual characteristic known as “data hiding” avoids unintended data corruption and provides greater system security.

Since the definition of a certain class is not only able to be reused by a program that it is especially built for, but also by other programs that are object oriented, it is then more efficiently distributed for network use. (Refer to the write once, use anywhere concept)

The data class concept enables a programmer to build any kind of new data that has not already  been defined  within  the parameters  of the language itself.


Getting to understand the use of applets

JAVA produces browser run programs which are called applets. Although applets are becoming more and more obsolete as time goes on, they are used to facilitate object intercommunication  by Web users and graphical user interface, or GUI. Before there were JAVA applets available,  Web pages and sites were normally not interactive and otherwise static.  Such competing products such as Microsoft Silverlight and Adobe Flash have made JAVA much less popular, since it once dominated the market. JAVA runs its applets on an internet browser using the JVM. The JVM then translates the specific code into what is known as “native processor instructions”, also known as  native code. This translation allows for indirect platform program or indirect Operating System (OS) execution. JAVA Virtual Machine supplies most of the components that are necessary in order to run bytecode. This bytecode is normally significantly smaller than other programming languages in which executable programs are normally written through. Basically, when used online, JAVA allows for applets to be used and also downloaded through a browser. This process allows the

browser to access a feature or perform a function that would normally not be available  without  the  applet.  The  program  or applet  must  be downloaded  or installed by the user before the user is able to fully access and use the JAVA program.

How JAVA differs from JavaScript

While  both  JAVA  and  JavaScript  are  programming  languages  used  to develop features or applications on a Web page, it is highly important that JAVA should not be confused with JavaScript. JavaScript originated at Netscape and is a little easier to learn than JAVA. JavaScript is also interpreted at a higher level than JAVA, meaning that JavaScript uses a programming language with a strong abstraction, or technique for managing the complexity of computer systems, from the details of the computer.  JavaScript,  however, does lack the speed of JAVA bytecode, as well as some of the portability. This means that the running speed  of  JavaScript  is  considerably  much  slower  than  that  of  JAVA.  JAVA applets are able to run on just about any operating system without necessitating recompilation  and  have  no  variations  or  extensions  that  are  unique  to  an operating  system. This is what makes JAVA generally  thought to be the most strategic language in developing Web applications. JavaScript, however, may be useful in extremely small applications that run on either the Web server or the Web client.
By far and wide, the most highly recognizable difference between JAVA and JavaScript  is the type of applications  in which they are used to create. JAVA programs are utilized for applications which are either initiated through a Web page or run from a computers desktop. These programs are standalone programs that  usually  open  a  completely   separate  program  window.  In  addition,  a computer is absolutely not able to run JAVA applications without JAVA having been installed. JavaScript is always included in all of the up to date browsers however, and will start the JavaScript on a Web page when the Web page is loading, as long as JavaScript has been enabled.
When a programmer is using JavaScript code, JavaScripts “thinking” and
calculations are consistently always performed on the client side. The client side refers to the computer where the page on the Web is initially accessed. On the other hand, JAVA programs do normally perform all of the main “thinking” and the calculations process within a certain JAVA applet that must first be downloaded, or on the server side. Because of the fact that JavaScript runs on the client side, it usually runs faster than JAVA, and is at times even almost instant, depending on the speed of the connection. Since JAVA programs are run on the

client side, it takes just a bit more time in order to process, but usually only several seconds or more.
JavaScript uses significantly less memory than JAVA, even very, very little memory in some cases, in order to do its processing and also perform correctly. Because of its lower memory requirements and its capability of offering so many varied  Web  page  features,  JavaScript  is  a  very  common  program  language utilized in many various pages on the Web at this present time. JAVA programs however, may sometimes require that a lot of computer memory be used in order to function properly. This requirement can absolutely cause another program to run at a much slower rate and even cause the computer to slow down altogether. So even while JAVA programs  have the innate  ability  to be developed  to do various, often powerful things because it utilizes a higher memory usage, it can also be a speed disadvantage in some respects.


Post a Comment

Previous Post Next Post