Pemrograman

Cari Blog Ini

Selasa, 20 Juli 2010

Beginning Java

Title : Beginning java
Author : Gunawan
Source : http://leopark62.blogspot.com
Edition : July 2010
License : Freely with not changes author attribut

CONTENT :

CHAPTER : 1

1. A little about Java
2. Java package division
3. Beginning Java programming
a. Write source code
b. Compile source code
c. Run binary's file (compiled source code)
d. Source code explanation

CHAPTER : 2

1. Package meaning
2. Managing path
3. Compile source code
4. Literal and constructor
5. Naming order


1. A little about java

Java is walking programming languages on multiplatform with motto “ Write once, Run Anywhere ” (WORA). Its mean, you just write once source code, but you can run it on different operating system like Windows or Linux. This indeed top that doesn't be had by other programming languages.

2. Java package division

On official sites://Java. sun. com can be found three division packages Javas which is:

a. Java 2 Enterprise Edition (J2EE).
- J2EE'S package is utilized on hardware that have big specification and memory like on server computer.

b. Java 2 Editon's Standards (J2SE).
- J2SE'S package is utilized on hardware as desktop computer( this one be we study here).

c. Java 2 Micro Edition (J2ME).
- J2ME'S package is utilized on peripheral that has memory little as handphone, or PDA.

3. Beginning Java Programming

Before you begin to study Java, better you make ready before tools which is required which is JDK or Development Kit J2SE's Java (Java 2 Standard edition) of official sites://Java. sun. com. Why choose J2SE? since our one studies is specialized Java programming for desktop computer. If you have had its file, therefore pleases install, if haven't, download then install at your computer. Remember, just can't utilize JRE (Runtime Environment's Java) Since JRE doesn't had attach compiler. Utilize JDK because in JDK was fledged all our one requires deep learning in here which is compiler and also it’s runtime environment.

a. Write source code

Actually, there are several IDE or development environtment or tool is affix who we can use to set down java source code as Eclipse or Netbeans . But since we are studying its basic programming, therefore I get initiative to utilize notepad even so we can easy understand it. After you install needful equipment, open editor text as notepad or use your favorite editor text. write is following text:

public class HelloWorld
// This is example comment 1
/* This
Is example
comment 2 */
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}

Then keeping by the name of HelloWorld.java. Remember, you must keep it by the name of HelloWorld.java, if its name don't be, therefore will emerge error messages upon your compile it. Keep that file on direktory c:\program files\java\jdk\bin.

b. Compile source code

After we write and save source code, hereafter we will compile the source code. Its trick which is click starts, vote for run then write cmd on dialog box, then OK click. Hereafter will emerge command's window (one that succeeding we will call shell). While are you install JDK therefore it’s default storage at c:\program files\java\. At deep directory that exists two direkori's subs again which is JDK and JRE. Java compiler on folder c:\program files\java\jdk…\bin\javac.exe. So, now write commands CD c:\program files\java\jdk\bin to activated directory java compiler. After its directory devolves, write javac HelloWorld.java for compile source code already we made. If no fault, therefore will appearance HelloWorld.class file.

c. Run binary file (compiled source code)

While is we are finished compile, therefore will appearance HelloWorld.class file. To run it which is write commands on shell as it: Java (space)HelloWorld (enter) that instruction will run HelloWorld.class file and in the shell you will see:
Hello World
Nicely cannikin? Hehe …., we have known slightly about Java programming. Let’s together study java more.

d. source's explanation code
- Programs Java code opened by sign “{ “ and closed by “}”
- Each instruction row is ended up with “; “
- Sign “ // “ denote comment until the end row
- Sign “ / * “ constitute comments also, but have to be closed by “ * / “
- Public class HelloWorld
• This is class name main who must there is in each Java program.
• Sign “{ “ one that lies under class HelloWorld constitutes scope opener from class HelloWorld and closed by “} “
• Sign place “{ “ can at post in the late class's name row or method.
– Example: public class HelloWorld{
– But that tidier looked code, therefore advisable is set down under.
- Public static void main (String args[])
• This is door who must there is in each program which wants we execute.
• That looking at opener sign “{ “ and shell “} “ shall ever there is to denote scope from class or method what does we declared.

Completed download here, Free.

Tidak ada komentar:

Posting Komentar

Apa tanggapan anda ?