Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Without programs, a computer is an empty machine. Computers do not understand human languages, so you need to use computer languages to communicate with them. Programs are written using programming languages.

Machine language is a set of primitive instructions built into every computer. The instructions are in the form of binary code, so you have to enter binary codes for various instructions. Program with native machine language is a tedious process. Moreover the programs are highly difficult to read and modify. For example, to add two numbers, you might write an instruction in binary like this:

1101101010011010

Assembly languages were developed to make programming easy. Since the computer cannot understand assembly language, however, a program called assembler is used to convert assembly language programs into machine code. For example, to add two numbers, you might write an instruction in assembly code like this:

ADDF3 R1, R2, R3

The high-level languages are English-like and easy to learn and program. For example, the following is a high-level language statement that computes the area of a circle with radius 5:

area = 5 * 5 * 3.1415;

Popular High-Level Languages

  • COBOL (COmmon Business Oriented Language)
  • FORTRAN (FORmula TRANslation)
  • BASIC (Beginner All-purpose Symbolic Instructional Code)
  • Pascal (named for Blaise Pascal)
  • Ada (named for Ada Lovelace)
  • C (whose developer designed B first)
  • Visual Basic (Basic-like visual language developed by Microsoft)
  • Delphi (Pascal-like visual language developed by Borland)
  • C++ (an object-oriented language, based on C)
  • C# (a Java-like language developed by Microsoft)
  • Java (an object-oriented language, We will studying in this tutorial)

Compiling Source Code

A program written in a high-level language is called a source program. Since a computer cannot understand a source program. Program called a compiler is used to translate the source program into a machine language program called an object program. The object program is often then linked with other supporting library code before the object can be executed on the machine.

Why learn Java Programming Language?

The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. The future of computing is being profoundly influenced by the Internet, and Java promises to remain a big part of that future.

  • Java is a general purpose programming language.
  • Java is the Internet programming language.
  • Java can be used to develop Web applications.
  • Java Applets
  • Java Web Applications

Java can also be used to develop applications for hand-held devices such as Palm and cell phones.

Examples of Java’s Versatility (Applets)

PDA and Cell Phone

Characteristics of Java

Java Is Simple

Java is partially modeled on C++, but greatly simplified and improved. Some people refer to Java as “C++–” because it is like C++ but with more functionality and fewer negative aspects.

Java Is Object-Oriented

Java is inherently object-oriented. Although many object-oriented languages began strictly as procedural languages, Java was designed from the start to be object-oriented. Object-oriented programming (OOP) is a popular programming approach that is replacing traditional procedural programming techniques.  One of the central issues in software development is how to reuse code. Object-oriented programming provides great flexibility, modularity, clarity, and reusability through encapsulation, inheritance, and polymorphism.

Java Is Distributed

Distributed computing involves several computers working together on a network. Java is designed to make distributed computing easy. Since networking capability is inherently integrated into Java, writing network programs is like sending and receiving data to and from a file.

Java Is Interpreted

You need an interpreter to run Java programs. The programs are compiled into the Java Virtual Machine code called bytecode. The bytecode is machine-independent and can run on any machine that has a Java interpreter, which is part of the Java Virtual Machine (JVM).  The JVM essentially runs between the computer and the java program. Java is designed so that any java program can run on any machine. This is because the JVM will interpret the Operating System independent java code and execute the commands needed for the particular Operating System you are trying to run the program on at the time. Unlike C/C++, which is compiled into machine language for a specific hardware platform, Java programs are compiled into an intermediate bytecode language. The bytecode is then compiled into machine language by a runtime program called the “Java Virtual Machine” (JVM)

Java Is Robust

Java compilers can detect many problems that would first show up at execution time in other languages.  Java has eliminated certain types of error-prone programming constructs found in other languages. Java has a runtime exception-handling feature to provide programming support for robustness.

Java Is Secure

Java implements several security mechanisms to protect your system against harm caused by stray programs.

Java Is Architecture-Neutral

Write once, run anywhere. With a Java Virtual Machine (JVM), you can write one program that will run on any platform.Java Is Portable

Because Java is architecture neutral, Java programs are portable. They can be run on any platform without being recompiled.

Java Is Multithreaded

Multithread programming is smoothly integrated in Java, whereas in other languages you have to call procedures specific to the operating system to enable multithreading.

Java Is Dynamic

Java was designed to adapt to an evolving environment. New code can be loaded on the fly without recompilation. There is no need for developers to create, and for users to install, major new software versions. New features can be incorporated transparently as needed.

JDK Editions

Java Standard Edition (J2SE)

J2SE can be used to develop client-side standalone applications or applets.

Java Enterprise Edition (J2EE)

J2EE can be used to develop server-side applications such as Java servlets and Java ServerPages.

Java Micro Edition (J2ME)

J2ME can be used to develop applications for mobile devices such as cell phones.

This tutorial uses J2SE to introduce Java programming.

Popular Java IDEs

  • NetBeans Open Source by Sun
  • Eclipse Open Source by IBM
  • JEdit
  •  JCreator
  • Or Plain old Notepad

A Simple Java Program

Creating and Editing Using NotePad

Creating, Compiling, and Running Programs

Trace a Program Execution

Java Program Structure

  • System.out is known as standard output object.
  • The System.out.println displays its arguments in the command window
  • A java program typically consists of one or more classes
  • Usually a separate class in separate file
  • Each file is named after the class that is defined in it
  • Extension of filename.java

Compiling and Running Java from the Command Window

Set path to JDK bin directory

set path=c:\Program Files\java\jdk1.6.0\bin

Set classpath to include the current directory

set classpath=.

Compile

javac Welcome.java

Run

java Welcome


Tagged with: JAVAObject OrientedProgramming
 

2 Responses to Introduction to Programming in JAVA

  1. supreeth says:

    i need to learn java ….

  2. F.Akele says:

    Excellent tutorial. Concise yet profound and comprehensive.
    Thank you

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Looking for something?

Use the form below to search the site:


Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Related News Feeds

Set your Twitter account name in your settings to use the TwitterBar Section.