Introduction to Java for Zombies

This topic is intended to give a very basic Introduction to Java programming language. We start with a little history and continue with its most important features. Its is the first post in Java for zombies series ūüėÄ
we will be covering java thoroughly in this series but in very zombie style of fast & easy ūüôā
so subscribe to email notification if you want to catch on it.

Introduction to java for zombies

Introduction to JAVA  the PROGRAMMING LANGUAGE

Java is an object – oriented programming language object –¬†oriented developed by Sun Microsystems in the early 90s its creator,¬†James Gosling, named it¬†Oak.

Sun wanted a language to program small electronic devices (appliances and other consumer electronics. The complexity of these devices were continually increasing and for a program to work on the next device, you must rewrite the code. So Sun wanted to create a language independent of the device.

This language was intended to alleviate one of the fundamental problems of C ++: to compile an executable file whose code is valid only for the platform on which the compilation was done.

The appearance in 1994 of the graphical browser Mosaic made Internet popular.

Sun realized that their project achievements were perfectly applicable to the Internet. Basically Internet is a global network that connects computers with different operating systems and different architectures. This idea made the project to develop a common language for consumer electronic devices to be abandoned and direct their research toward developing a language that would create applications that will run on any computer on the Internet.

In 1995 Oak renamed Java. Java is named after a type of coffee in USA is known as Java coffee, a cup of Java is a cup of coffee. Hence the official Java logo is a steaming cup of coffee.

The year it’s released for the public it gained popularity quickly, almost since its launch. People started talking about Java and its applets. An applet is a Java program that runs in the context of a web page on any computer regardless of operating system and processor architecture.

The runtime environment was relatively safe and major web browsers soon incorporated the ability to run Java applets embedded in web pages.

During the upcoming years it has been improved and revised heavily. Modified version 1.2 Java was called Java 2 and also their descendants (Java 1.3 and Java 1.4). Currently the number 2 has been removed from the name and the last version is known as Java 8.

FEATURES Of LANGUAGE JAVA

EASY
eliminates the complexity of languages such as C and opened the context of modern object-oriented languages. Although Java syntax is very similar to C ++, it eliminates some of the most contentious features of this language, including:

  • No pointers.
  • No overload operators.
  • Does not allow multiple inheritance.
  • No need to free up memory manually.
  • Dynamic memory management is done automatically (garbage collector).

OBJECT-ORIENTED
It is a pure object-oriented language.¬†Java accept all the basic variable types (int, char, double …) as an object.
MULTI PLATFORM
To eliminate the dependency of the machine, a program in Java does not translate directly into executable code.
A Java (.java) program is compiled and a code called bytecode (.class) is obtained.

The bytecode interpreted by the Java Virtual Machine (JVM).

It is also known as JRE (Java Runtime Environment, Java Runtime Environment).

The JRE or Java virtual machine is distributed free for virtually all operating systems, which means that a .class file can be run on any computer or machine incorporating the JRE.

The bytecodes are interpreted by different computers in the same way, so you just have to implement a virtual machine for each platform.

The programmer compiles a one-time Java program, and the bytecode file that gets executed by the virtual machine like Java on any platform (Windows, Linux, MacOS, etc.). Thus Java language that manages to be not dependent on a specific computer architecture.

Execution by the virtual machine makes Java programs run slower than programs written in C ++.

To increase execution speed:-

–¬†¬†¬†Compile native code: the java program can be compiled and is executable to machine code directly.¬†But we lose portability.

–¬†¬†¬†Compilers JIT (Just-In-Time): As you are interpreting bytecode generated code in a buffer machine is stored.¬†Thus it¬†is not necessary to translate the code again and translated what we gain in speed.

ROBUST
Java performs checks for problems both at compile time and runtime.

The Java type checking helps detect errors as soon as possible in the development cycle. Java requires the explicit statement of methods, thus reducing the chances of error.

Manages memory to eliminate concerns by the programmer release or memory corruption.
It also implements the arrays genuine, instead of linked lists of pointers, with bounds checking, to avoid the possibility of overwriting or corrupting memory result of pointers that point to the wrong areas. These features drastically reduce the time spent on the development of Java applications.

DEPENDABLE
Contrary to what happens with C / C ++, you cannot access the memory using pointers.

In addition Java incorporates measures that prevent can encode virus with this language. There are many restrictions, especially for applets, which limit what you can and cannot do with the critical resources of a computer.

MULTITASK
It supports multiple threads, threads or tasks. This means you can run different lines of code at the same time whether the machine is multiprocessor as if it is not.

DYNAMIC
Java is not necessary to completely load the program into memory but the compiled classes can be loaded on demand at run-time (dynamic binding).

This process allows the loading of code on demand, which is especially important in applets.

Types of applications that can be developed with JAVA

APPLETS
They are intended to be placed within a web page Java programs. They can be interpreted by any browser with Java capabilities. These programs are inserted into pages using a special label (such as videos are also inserted, flash animations or other objects).

Today through applets can be integrated into web pages advanced multimedia applications (even with 3D video images or sound and high quality)

SERVLETS
There are applications running in an application server.

APPLICATIONS CONSOLE
Are independent programs like those created with traditional languages.

Graphical Applications
Those who use Java classes with graphics capabilities.

MIDlet
Application designed to run on mobile devices. For example, Java games created for mobile phones.

Android
Java is the base of android development

PLATFORM JAVA

A platform is the hardware or software environment in which a program runs.

The Java platform consists of two components:

– Java Virtual Machine

– Java API (Application Programming Interface, application programming interface)

Java API is a collection of libraries with standard classes.

These classes can be included in Java programs without fear of failure portability. They are also well documented (through Web pages), and organized in packages and in a large inheritance tree.

This whole package is known as the API of Java.

Basic packages Java API are:
PACKAGES UTILITIES

java.lang : Fundamental for language. It includes classes like String or StringBuffer.
java.io : For the input and output through data streams, and system files.
java.util Contains data collections and classes, event model, time facilities, random number generation, and other utility classes.
java.math : Classes for arithmetic accuracy desired.
java.text : Classes and interfaces for handling text, dates, numbers , and messages in a manner independent of natural languages.
java.security¬†: Classes and interfaces for Java security: RSA encryption …

PACKAGES FOR DRAWING DEVELOPMENT

java.applet
 : To create applets and classes that applets use to communicate with their context.
java.awt : To create user interfaces, and to draw images and graphics.
javax.swing : Set of graphical components that work the same on all platforms that support Java.
javax.accesibility : Supports accessibility classes for the disabled.
java.beans : To develop JavaBeans.

PACKAGES FOR DEVELOPMENT NETWORK

java.net : Classes for network applications.
java.sql : Pack containing the JDBC, Java programs to connect with databases.
java.rmi : RMI package to locate remote objects, communicate with them and even send objects as parameters from one object to another.
org.omg.CORBA : Facilitates the possibility of using OMG CORBA, for connection between distributed objects, even if it is encoded in different languages.
org.omb.CosNaming : Da Java IDL service, similar to RMI but CORBA

There are currently three editions of Java. Each corresponds to a platform that includes a number of functions, packages and language elements (API).

JAVA SE.  (Java Standard Edition)
Before it was known as J2SE. It allows writing Java code related to creating common applications and applets in Java.

JAVA EE.  (Java Enterprise Edition)
Still known as J2EE. Designed for building enterprise Java applications and server side.

Java ME.  (Java Micro Edition)
Also known as J2ME. Designed for creating Java applications for mobile devices, PDAs and other electronic devices.

The JDK

To write a Java program you must have the Java Development Kit or JDK (installed Java Development Kit), also called Java SDK (Software Development Kit).
The JDK contains the necessary programmers to compile software, debug and implement programs and applets written in Java.
The software and documentation are free according to the license agreement Sun Microsystems.

It can be downloaded from here at oracle website

On this page you can also download the JRE.

The JDK environment is not the most suitable for the development of Java applications due to run exclusively by console commands:
javac  is the Java compiler command.

Its syntax is:
javac example.java

The entry of this command must necessarily be a file containing code written in Java language and .java. The command will create us a .class for each class file containing the Java file.
.class Bytecode files contain code, the code is interpreted by the virtual machine.

Java as the Java interpreter.

It allows you to run applications that have been previously compiled and transformed into .class files.
Its syntax is:

java example
It is not necessary here to supply the file extension because it must always be a class file.

appletviewer is a command that verifies the behavior of an applet. Command input must be a web page that contains a reference to the applet we wish to test.

Its syntax is:
appletviewer mypage.html
The command ignores all content on the website that are not limited to applets and run them.

javadoc Generates documentation in HTML format on the content of files with .java extension.

Its syntax is:
javadoc ejemplo.java

In the documentation generated by this command you can see that methods and constructors has a certain class, along with comments on its use, version, and the author of the class….

You have to pay attention to the directory where you installed the JDK. The reason is that we amend three system variables:

PATH
Variable that contains default routes to programs indicate. The reason is that for example the command java should be available are in the folder we are. This command (together with other commands JDK) is in the folder bin inside the folder where you have installed the JDK

JAVA_HOME
Variable used by most applications based on Java that contains the path to the folder where the JDK was installed.

CLASSPATH
This is similar to the PATH used to indicate routes to the folders in which Java applications are stored variable.

How to set these variables in Windows:-
Open the context menu of My Computer (or Computer in Windows 7, Windows 8 & This PC in Windows 10) and choose Properties. Then choose Advanced Properties and finally click on the button Environment Variables

Select the PATH variable and click Modify. Without erasing anything that contains, we must add text at the end of the symbol, and then the path to the bin directory within the JDK folder.

After accepting the above table, we can click on New to add the JAVA_HOME variable as a value indicating the path to the JDK.

We can check if everything was successful by checking the version of Java. To check the version of Java just go to the Windows command prompt and type
java -version

VERSIONS OF JDK

Java has undergone numerous changes since the first version, JDK 1.0, as well as a huge increase in the number of classes and packages that make up the standard library

From version 1.2 there is talk of Java 2. From version 1.6 stop using J2SE to call Java SE 6, Java SE 7.Each version has several revisions, for example JDK version 1.6.7 refers to revision 7 version 6.

DOCUMENTATION. JAVA API

In the official Java documentation.

The most interesting is the documentation of the API of Java.
You can download the documentation in a zip file. Thus we not depend on the Internet to consult the official documentation. This can be done from the download page

ENVIRONMENTS FOR JAVA DEVELOPMENT

The basic development kit provided by Sun is the minimum needed to develop a Java program. It is useful if you need to compile Java applications sporadically
However, writing and compiling programs made in this way is a little uncomfortable. Therefore many companies manufacture their own editing environments, some include the compiler and others use the Sun JDK itself

Some advantages are:

  • Facilities for writing code.
  • Facilities debugging.
  • Easy system configuration.
  • Facilities for organizing code files.
  • Easy to export and import projects

Development environments for Java more used today are:

NETBEANS
One of the most popular Java IDE. It is a free open environment for code generation code in different languages.

It contains virtually everything that is often ask a development environment, advanced code editor, debugger, different languages, extensions of all types (CORBA, Servlets, …).

It also includes a Tomcat application server or Glass fish server to test server applications.

Consume enough resources. It has an extensible architecture with specific modules for web development, mobile applications, UML design, etc.

It can be obtained free
ECLIPSE
Along with NetBeans, the Java development environment most used free is a complete open source environment.
It also allows development in C ++ and other programming languages.
It can be downloaded
BORLAND JBUILDER
Complete development environment created by the company Borland for creating all kinds of Java applications including mobile applications. There are limited versions that can be downloaded from www.borland.com

MICROSOFT VISUAL J #
One of the most popular, although applications obtained may have compatibility issues with the official SDK for Java, by the use of specific libraries Microsoft.

Can build Java applications within the .NET platform. The express version can be obtained free here

so here we terminate with Introduction to java the very first article of the Java for zombies series please do subscribe for subsequent updates to this series and you can ask your questions and doubts the comments section below or write to us directly from the contact us page

we also provide Programming and App development services if you need any help with your Java Programming assignments or Homework you can get it done by us Just head over to contact us to get any Programming assignment help

Leave a reply