Você está na página 1de 15

Pemrograman

Dasar
Warsun Najib
www.te.ugm.ac.id/~warsun/pemrograman
Email: warsun@te.ugm.ac.id

Perkembangan Bahasa
Generasi I : Bahasa Mesin
Pemrograman
V
1.

Object-Oriented

IV
Deklaratif
III
High Level Lg

II
Low Level Lg.
I
Bahasa Mesin

2.

ENIAC (Electronic Numerical Integrator and


Calculator) pada tahun 1945 oleh Mauchly
and Eckert.
menggunakan kode-kode biner (0 dan 1),
dengan basis dasar transistor. On = 1,
dan kondisi Off = 0.
Rumit, sukar dihafal, dan lama
Dikembangkan dg bilangan oktal dan
heksadesimal

Generasi II : Low Level Language

Penyempurnaan dari bahasa mesin


Bahasa assembly sudah mulai memasukkan
unsur kata bahasa inggris meskipun dalam
bentuk singkat.
Bersifat machine dependent
Penulisan bahasa assembly sudah jauh
lebih mudah dibanding dengan bahasa
mesin, namun masih terlalu sulit bagi orang
awam yang tidak memahami perangkat
keras komputer, karena beberapa variabel
masih mengacu pada register, alamat
memori maupun alamat port I/O.

Perkembangan Bahasa
Pemrograman
3. Generasi III : High(2)
Level Language

1950, FORTRAN (FORmula TRANslator), yang


sudah bersifat machine independent.
Diikuti bahasa pemrograman aras tinggi spt :
BASIC, COBOL, PL/1, PASCAL, ALGOL,
PROLOG, C, dsb.
Pemrosesan program oleh komputer dlm
bahasa aras tinggi ini meliputi:

Compilation,
Link,
Execution

Perkembangan Bahasa
Pemrograman
(3)Deklaratif
4.
Generasi IV : Bahasa

5.

Bahasa pemrograman ini jauh lebih mudah


ditulis karena instruksinya sudah sangat
mendekati bahasa percakapan sehari-hari.
misal : LIST NAMA, ALAMAT, NILAI FOR NILAI
>7
Ex: DBASE, SQL (structured query language)

Generasi V : Object-Oriented Language

Ex : SIMULA, SmallTalk, Ada, C++, Java

Car
-Colour
-wheel
-year

Person
-name
-address
-phone

JAVA
PROGRAMING
LANGUAGE

The Java Programming


Language

The Java programming language is a high-level


language that can be characterized by all of the
following buzzwords:

Simple
Architecture neutral
Object oriented
Portable
Distributed
High performance
Interpreted
Multithreaded
Robust
Dynamic
Secure

Compiler and Interpreter

JAVA Application

Write program (create application) in JAVA

Create source code


Compile to bytecode
Run the program in the bytecode

Java Application and


The most common Java programs are
Applets

applications and applets.


Applications are standalone programs.
Applets are similar to applications, but
they don't run standalone. Instead,
applets adhere to a set of conventions that
lets them run within a Java-compatible
browser. An is applet embedded in HTML
page.

To Write Java Program

The Java 2 Platform Standard Edition


(Dulu dikenal dengan nama JDK).

Dapat didownload di :
http://java.sun.com/j2se/1.4/download.html

A text editor

Notepad, Textpad, etc

Other tools
Java IDE (integrated development
environment)

Jbuilder, Forte for Java (free download), etc

The Java Platform

A platform is the hardware or software


environment in which a program runs. We've
already mentioned some of the most popular
platforms like Windows 2000, Linux, Solaris, and
MacOS. Most platforms can be described as a
combination of the operating system and
hardware. The Java platform differs from most
other platforms in that it's a software-only
platform that runs on top of other hardwarebased platforms.
The Java platform has two components:

The Java Virtual Machine (Java VM)


The Java Application Programming Interface (Java API)
The Java API is a large collection of ready-made software
components that provide many useful capabilities, such
as graphical user interface (GUI) widgets. The Java API
is grouped into libraries of related classes and interfaces;
these libraries are known as packages.

Java Platform

The following figure depicts a program that's running on the


Java platform. As the figure shows, the Java API and the
virtual machine insulate the program from the hardware.

Native code is code that after you compile it, the compiled
code runs on a specific hardware platform. As a platformindependent environment, the Java platform can be a bit
slower than native code. However, smart compilers, welltuned interpreters, and just-in-time bytecode compilers can
bring performance close to that of native code without
threatening portability.

Hello World

Source Code

/** * The HelloWorldApp class implements an application that *


displays "Hello World!" to the standard output. */
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

Compilation

One more Example


public class BasicsDemo {
public static void main(String[] args) {
int sum = 0;
for (int current = 1; current <= 10; current++)
{ sum += current;}
System.out.println("Sum = " + sum);
}
}

Você também pode gostar