Java Tutorials – AndroWep

What is Java

Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is know as the father of Java.

Platform: Any hardware or software environment in which a program runs, is known as a platform. Java has a run time environment (JRE) and API, it is called a platform.

First Code

class Example {     
    public static void main(String args[]) {     
             System.out.println("This is a simple Java program.");  

Types of Java Applications

There are mainly 4 types of applications that can be create using Java programming:

1) Standalone Application

Standalone applications are also known as desktop applications or window-base applications. These are traditional software that we need to install on every machine.

2) Web Application

An application that runs on the server side and creates a dynamic page is call a web application. Currently, Servlet, JSP, Struts, Spring, Hibernate, JSF, etc. technologies are use for creating web applications in Java.

3) Enterprise Application

An application that is distribute in nature, such as banking applications, etc. is call enterprise application. It has advantages of the high-level security, load balancing, and clustering.

4) Mobile Application

An application which is create for mobile devices is call a mobile application. Currently, Android and Java ME are use for creating mobile applications.

The Java Buzzwords

  • Simple
  • Secure
  • Portable
  • Object-oriented
  • Robust
  • Multithreaded
  • Architecture-neutral
  • Interpreted
  • High performance
  • Distributed
  • Dynamic


One outcome of this was a clean, usable, pragmatic approach to objects. Borrowing liberally from many seminal object-software environments of the last few decades, Java manages to strike a balance between the purist’s “everything is an object” paradigm and the pragmatist’s “stay out of my way” model.


The multiplatformed environment of the Web places extraordinary demands on a program, because the program must execute reliably in a variety of systems. To gain reliability, Java restricts you in a few key areas to force you to find your mistakes early in program development.


To accomplish this, Java supports multithreaded programming, which allows you to write programs that do many things simultaneously. The Java run-time system comes with an elegant yet sophisticated solution for multiprocess synchronization that enables you to construct smoothly running interactive systems.

Interpreted and High Performance

As described earlier, Java enables the creation of cross-platform programs by compiling into an intermediate representation called Java bytecode. Most previous attempts at cross-platform solutions have done so at the expense of performance.


In fact, accessing a resource using a URL is not much different from accessing a file. Java also supports Remote Method Invocation (RMI). This feature enables a program to invoke methods across a network.


This makes it possible to dynamically link code in a safe and expedient manner. This is crucial to the robustness of the Java environment, in which small fragments of byte code may be dynamically updated on a running system.

An Overview of Java

As in all other computer languages, the elements of Java do not exist in isolation. Rather, they work together to form the language as a whole. However, this interrelatedness can make it difficult to describe one aspect of Java without involving several others. Often a discussion of one feature implies prior knowledge of another. For this reason, this chapter presents a quick overview of several key features of Java. The material described here will give you a foothold that will allow you to write and understand simple programs. Most of the topics discussed will be examined in greater detail in the remaining chapters of Part I.

Object-Oriented Programming

Object-oriented programming (OOP) is at the core of Java. In fact, all Java programs are to at least some extent object-oriented. OOP is so integral to Java that it is best to understand its basic principles before you begin writing even simple Java programs. Therefore, this chapter begins with a discussion of the theoretical aspects of OOP.

Two Paradigms

All computer programs consist of two elements: code and data. Furthermore, a program can be conceptually organized around its code or around its data. That is, some programs are written around “what is happening” and others are written around “who is being affected.” These are the two paradigms that govern how a program is constructed. The first way is called the process-oriented model. This approach characterizes a program as a series of linear steps (that is, code). The process-oriented model can be thought of as code acting on data. Procedural languages such as C employ this model to considerable success. However, as mentioned in Chapter 1, problems with this approach appear as programs grow larger and more complex.


An essential element of object-oriented programming is abstraction. Humans manage complexity through abstraction. For example, people do not think of a car as a set of tens of thousands of individual parts. They think of it as a well-defined object with its own unique behavior. This abstraction allows people to use a car to drive to the grocery store without being overwhelmed by the complexity of the parts that form the car. They can ignore the details of how the engine, transmission, and braking systems work. Instead, they are free to utilize the object as a whole.