java application development, Java Language Essentials, java programming language, java application development, object oriented
java application development, object oriented programming Language Essentials, enterprise solution, flash, e-commerce packages, dedicated server hosting
 


Java Application Development and Java Language Essentials

Introduction

This tutorial will focus on the Java language essentials. Even if you have no programming experience, you will find this article very useful. The Java programming language is a modern, evolutionary computing language that combines an elegant language design with powerful features that were previously available in other languages.
Java is an Object Oriented programming language. This means that everything is an object in Java and thus you can design programs that represent any real world entities such as employees, cars, etc. Java provides a class construct for representing user-defined entities. The class construct supports the creation of user-defined data types, such as Employee, that represent both the data that describes a particular employee and the manipulation or use of that data.
The following sections illustrate Java syntax and program design in the context of several Java class definitions.

Data Types
To define a user defined data type in Java, you have to use the class construct. For example, to create a program that behaves like a Car, you have to define a class that represents a car.
class Car {
void changeGear() {
System.out.println("Gear Changed");
}
}
The user defined data type begins with the keyword class, followed by its name, Car.

Methods
A method is a program construct that provides the mechanism for performing some act, in this case, changeGear. Given an instance of some entity, you invoke behavior with a dot syntax that associates an instance with a method in the class definition:
<instance>.<method>(<arguments>….)
For example, to invoke the method of a Car named mercedes:
mercedes.changeGear()
The Java programming language is strongly typed, meaning that it expects variables, variable values, return types, and so on, to match properly, partly because data types are used to distinguish among multiple methods with the same name. Method return types and parameters are specified during definition:
<return-type> <method-name>(<arguments>….) { }

Applications
Java applications consist of one or more classes that define data and behavior. When Java applications are compiled, they are translated in a stream of data called bytecode. The operations in the bytecode stream implement an instruction set for Java virtual machine. Programs that implement the JVM simply process Java class files, sometimes specific to a particular environment. The Java compiler stores this bytecode stream in a class file with the filename extension .class. Any Java interpreter can read/process this stream--it interprets each operation and its accompanying data (operands).
Java class files are portable across platforms. Because Java compilers produce bytecode files that follow a prescribed format and are machine independent, and because any Java interpreter can read and further translate the bytecodes to machine instructions, a Java program runs anywhere--without recompilation.
A class definition such as Car is stored in a Java source file with a matching name, in this case, Car.java. A Java compiler processes the source file producing the bytecode class file, in this case, Car.class.
A Java program consists of one or more class files, one of which must define a program starting point. In Java, a program's starting point is defined by a method named main. Likewise, a program must have a well-defined stopping point. With the Java programming language, one way to stop a program is by invoking/executing the method exit.
public class MyFirstProgram {
public static void main(String[] args) {
System.out.println("This is my first program.");
System.exit(0);
}
}

The signature for main is invariable. Also, System (java.lang.System) is a standard Java class; it defines many utility-type operations. Note that the 0 in the call to exit indicates to the calling program, the Java interpreter, that nothing went wrong; that is, the program is terminating normally, not in an error state.


References for more information:-
Complete information on the Java programming language, including all syntax-related issues such as operator precedence, literals, and so on is available on Sun Microsystems's site, http://java.sun.com. You can also read some good books on Java like:
1) Java 2 : The Complete Reference
by Patrick Naughton, Herbert Schildt
2) Thinking in Java by Bruce Eckel

Useful Links
1) http://64.46.110.163/eckel/TIJ-2nd-edition.zip
2) http://java.sun.com/docs/books/tutorial/

CONSULTATION

KVC recognizes that to keep your company competitive, we must offer advice and support on the innovations and technologies...

PROMOTE

Web Site Promotion is perhaps the most important factor in creating a web site that works.


questions?
support@kvcindia.com

HOSTING 4


Get the best of both worlds-
Quality Service at Competitive Prices

PRODUCTS
Download a quiz, a site of the day application and a poll. We also offer customizable products developed to fit to your exact needs.
Support Ticket
QUESTIONS?
    support@kvcindia.com