Download Pemrograman Dasar

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Pemrograman Dasar
Warsun Najib
www.te.ugm.ac.id/~warsun/pemrograman
Email: [email protected]
Perkembangan Bahasa Pemrograman
1.
V
Object-Oriented
Generasi I : Bahasa Mesin


IV
Deklaratif
III
High Level Lg


2.
Generasi II : Low Level Language



II
Low Level Lg.
I
Bahasa Mesin
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

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 (2)
3.
Generasi III : High 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)
4.
Generasi IV : Bahasa Deklaratif


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 Applets
The most common Java programs are
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 Javacompatible 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);
}
}