Pages

Subscribe:

Minggu, 26 Juni 2011

Basic Concepts of Programming with Java

Is Java?
Java is object-oriented programming language developed by Sun Microsystems since 1991. This language was developed with a model that is similar to C + + and Smalltalk, but is designed for easy use and platform independent, which can run on different types of operating systems and computer architecture. The language is also designed for programming on the Internet that is designed to be secure and portable.
Platform Independent
Platform independent means that programs written in Java can be easily transferred between different types of operating systems and various types of computer architectures. This aspect is very important to be able to achieve the purpose of Java as an Internet programming language where a program will be run by different types of computers with different types of operating systems. This property applies to the level of source code and binary code from Java programs. Unlike the C language and C + +, all data types in the Java language has a size that is consistent across all types of platforms. Java source code program itself does not need to be changed at all if you want to recompile on other platforms. The results of the compile Java source code is not machine code or processor instructions that are specific to a particular machine, but rather a form of bytecode files ending in. Class. Bytecode execution can direct you at each platform using the Java Virtual Machine (JVM) as the interpreter of the bytecode.
JVM itself is an application that runs on top of an operating system and translates and executes Java bytecode programs, so that the concept can be regarded as an interpreter. The process of executing Java programs can be depicted as in Figure 1. In this way, a Java program that has been compiled to be run on any platform, provided there is a JVM in there.
Compiler and interpreter for Java programs shaped the Java Development Kit (JDK) manufactured by Sun Microsystems. JDK can be downloaded for free from java.sun.com site. Interpreter for the Java program itself is often also called the Java Runtime or Java Virtual Machine. Java interpreter, without a compiler, called the Java Runtime Environment (JRE) can be downloaded also at the same site. To develop the required JDK Java programs, whereas if you just want to run Java bytecode enough with JRE alone. However, to execute an applet (a Java bytecode as well) you usually do not need to download the JRE for the Java-enabled browser has its own JVM.
Library
In addition to the compiler and interpreter, the Java language itself has a fairly large library that can facilitate you in making an application quickly. This library has been included for graphics, user interface design, cryptography, network, sound, databases, and others.
OO
Java is object-oriented programming language. Explicitly object-oriented programming is a technique for organizing the program and can be done with almost any programming language. But Java itself has implemented various facilities so that a programmer can optimize object-oriented programming techniques.
Little additional comparison with C and C + +, Java inherited many object-oriented concepts of C + +, but by eliminating aspects of complexity in C + + without reducing its strength. It is easier for novice programmers to learn Java, but reduce the flexibility programmers experienced in tinkering with a program. Behind the convenience offered by Java, the extent of its own Java library facilities to make a programmer takes a short not to be able to master the use of these libraries.
Starting the Java Programming
To create a Java program, as previously mentioned, you need a JDK. JDK installation process is very easy and requires no specific knowledge. But to use it you need to make some adjustments to your operating system. Generally you need to do is enter the path to your JDK directory to the path settings in your operating system. Suppose your JDK directory is C: \ JDK1.4 on Windows 98 then you can simply add the command line SET PATH = C: \ JDK1.4 \ bin to your autoexec.bat file. For Windows NT/2000/XP you can simply add the directory C: \ JDK1.4 \ bin to the path variable in the System Environment. Here's how: Right-click the My Computer icon, select Properties. Then select the Advanced tab. Then click the button Environment Variables, find the path variable, then add the path to your JDK directory into the variable. For Linux, add the command line SET CLASSPATH = (your jdk directory) to your profile file. To try JDK, type java and javac commands in a shell prompt (or DOS Command Prompt). If the command is already known then the program java or javac will display the usage syntax. For convenience and a variety of additional facilities you can use the Integrated Development Environment (IDE) for Java language such as Visual Café from Symantec or JBuilder from Borland.
Sequence of steps that you must do to create a simple Java program are:

    
Creating a program's source code with any text editor. Remember, the file must be ending. Java and case sensitive.
    
Compile the source code with the javac command. For example: javac HelloWorld.java. If successful, the result is a bytecode file ends in. Class.
    
Executing the command java bytecode. The parameters of this command is the file name without extension compilation. Class. Example: java HelloWorld.

Tidak ada komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...