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:
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.
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
- 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
- Java Language Basics: Operators and Constructs
- JDBC (Java Database Connectivity)
- UDP Datagram Sockets in Java
- This Pointer, Static Members and destructors in C++
- Sockets and Network Programming in Java
- Object Oriented Programming Concepts in Java
- Basics of Java Program and Java Language
- Abstract Classes and Interfaces in Java
- Inheritance in Java
- Factory Method Design Pattern
- Event Handling in JAVA GUI
- Thread Programming in Java
Popular Posts (last 30 days)
- Circular Linked Lists 1300 view(s)
- Attendance Management Sys… 1065 view(s)
- Applications of Stack in … 1058 view(s)
- Graph Implementation in C… 904 view(s)
- Implementing Stack Data S… 775 view(s)
- Simple Currency Converter… 661 view(s)
- GRASP Design Patterns 501 view(s)
- Recursive Factorial funct… 490 view(s)
- Finding Minimum, Maximum … 364 view(s)
- Implementation of Priorit… 310 view(s)
TagsAndroid C-Sharp C/C++ language Classes Data structures Design Pattern Eclipse Game Development Graphics Design Books HTML iPhone JAVA JAVA GUI MIPS Assembly Mobile Programming Books Object Oriented PDF PHP Programming Programming Books Programming Languages Books Python RaphaelJS REST Source Code Threads Tutorial Web Development Books