Ziddu.com

Pemograman Java

Diposting oleh maniactoons | 04.44 | | 0 komentar »

INTRODUCTION oop

Oop, Object Oriented programming
Pemograman a form that supports Encapsulasi, Inheritance, and Polymorphyms

a class pemograman language and techniques that are based on an object, where data structures terenkapsulasi routine that operates with the data.

Triangle Program
class Triangle (
protected int base;
protected int level;

void setAlas (int newValue) (
base = newValue;
)

void setTinggi (int newValue) (
high = newValue;
)

double getLuas () (
return 0.5 * base * high;
)

)
Program calculated the triangle
(class hitungsegitiga

public static void main (String [] args) (
s triangle = new Triangle ();
s.setAlas (9);
s.setTinggi (9);
System.out.println ( "Area is:" + s.getLuas ());
)
)

0 komentar

Posting Komentar

Navigasi