<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-364476326115322705</id><updated>2024-09-22T05:22:30.506-07:00</updated><title type='text'>BELAJAR PEMROGRAMAN JAVA DASAR</title><subtitle type='html'>Terima kasih Anda telah mengunjungi situs ini. Situs Belajar Java ini diperuntukkan untuk orang Indonesia yang ingin belajar bahasa pemrograman Java.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ananksim.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://ananksim.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>NANANG</name><uri>http://www.blogger.com/profile/14034668181797145003</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hTpYSbqP2x2y-UzHq7dIft9f3WZbidltypRiQ4XrUtFwia-_51DLmSsSwPiyVFZeCFKyNhiP0yGRBMYBY6n91XKuw1Cm2lqYlkpnw9LThd0kFnaWdNfK00EHc2W74A/s220/nanang.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-364476326115322705.post-740992979633140959</id><published>2009-10-18T08:40:00.000-07:00</published><updated>2009-10-18T08:41:54.020-07:00</updated><title type='text'>Polimorphism</title><content type='html'>&lt;h2 style=&quot;font-weight: bold; color: rgb(255, 0, 0);&quot;&gt;Polimorphism&lt;/h2&gt;&lt;p&gt;Polimorphism bisa diartikan sebagai suatu object yang  dapat memiliki berbagai bentuk, sebagai object dari classnya sendiri atau object dari superclassnya&lt;/p&gt; &lt;p&gt;Polimorphism ada 2 macam;&lt;/p&gt; &lt;ol&gt;&lt;li&gt;Overloading, Penggunaan satu nama untuk beberapa method yang berbeda parameter&lt;/li&gt;&lt;li&gt;Overriding, Terjadi ketika deklarasi method subclass sama dengan method dari superclassnya&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;OVERLOADING&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Dalam sebuah kelas diperbolehkan ada lebih dari satu method dengan nama yang sama dengan catatan methods dapat dibedakan berdasarkan banyaknya parameter atau tipe data parameter formal&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;span id=&quot;more-59&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double r;&lt;br /&gt;Lingkaran (double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;this.r = r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas (double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overloading method Luas() beda signature&lt;br /&gt;this.r = r;&lt;br /&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas (int r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overloading method Luas() beda signature&lt;br /&gt;System.out.println(”tipe data harus double. r tidak diubah!”);&lt;br /&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas (double r, double PI) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overloading method Luas() beda signature&lt;br /&gt;this.r = r;&lt;br /&gt;return PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;ul&gt;&lt;li&gt;Overloading tidak bisa dilakukan dengan membedakan nilai kembaliannya&lt;/li&gt;&lt;/ul&gt; &lt;blockquote&gt;&lt;p&gt;class Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double r;&lt;br /&gt;Lingkaran (double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;this.r = r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;ul&gt;&lt;li&gt;Overloading juga bisa dilakukan pada sub kelasnya&lt;/li&gt;&lt;/ul&gt; &lt;blockquote&gt;&lt;p&gt;class Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double r;&lt;br /&gt;Lingkaran(double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;this.r = r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas(double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overloading method Luas() beda signature&lt;br /&gt;this.r = r;&lt;br /&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas(int r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overloading method Luas() beda signature&lt;br /&gt;System.out.println(”tipe data harus double. r tidak diubah!”);&lt;br /&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas(double r, double PI) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overloading method Luas() beda signature&lt;br /&gt;this.r = r;&lt;br /&gt;return PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt;&lt;p&gt;class Tabung extends Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double h;&lt;br /&gt;Tabung() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;super(0);&lt;br /&gt;//konstruktor kelas turunan, ada keyword super()&lt;br /&gt;//diisi nilai awal&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas(double r, double PI, double h) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overloading method Luas() beda signature&lt;br /&gt;this.r = r;&lt;br /&gt;return PI*this.r*this.r*this.h;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Overloading method dapat digunakan ketika kita mempunyai operasi yang sama namun berbeda implementasinya. Yang terpenting dalam melakukan ini, nama method harus sama, tapi mempunyai parameter yang berbeda. Terserah berbeda dari segi tipe datanya atau jumlah parameternya. Tergantung kebutuhan untuk implementasi dan nilai kembaliannya. Jadi yang perlu diingat saat melakukan overloading method:&lt;/p&gt; &lt;p&gt;• Nama method sama&lt;/p&gt; &lt;p&gt;• Parameter berbeda (baik tipe maupun jumlahnya)&lt;/p&gt; &lt;p&gt;• Tipe data nilai kembalian dapat berbeda atau sama&lt;/p&gt; &lt;p&gt;Overloading itu mendeklarasikan lebih dari satu kali dengan syarat-syarat tertentu. baik overloading method ataupun konstruktor&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;OVERRIDING&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Overriding konsepnya sama dengan overloading yaitu menulis kembali method. Namun, caranya overriding menulis kembali method sama persis. Sama mulai dari nama method dan isinya dan mengimplementasi kembali di sub classnya. Overriding dipakai saat kita menggunakan method yang sama tapi berbeda implementasinya. Jadi overriding method mempunyai nama method yang sama, jumlah parameter dan tipe parameter serta nilai kembalian (return) method yang di override. Jika method memiliki modifier akses public, method overridenya juga harus public.&lt;/p&gt; &lt;p&gt;Contoh:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class Kendaraan {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;public String getJenis() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;System.out.println(“Harga BBM turun”);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;class Motor extends Kendaraan {&lt;/p&gt; &lt;p&gt;public String getJenis() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;System.out.println(“Harga BBM premium 4000 rupiah”);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;NB:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;class motor mengextends class kendaraan&lt;/li&gt;&lt;li&gt;class motor melakukan override method di kendaraan namun berbeda implementasi&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Kesimpulan:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Override method merupakan method yang sama persis dengan method yang sudah ada di super kelasnya, biasanya perbedaannya adalah pada implementasi (program body)&lt;/li&gt;&lt;li&gt;Overidding tidak bisa dilakukan dalam kelas itu sendiri&lt;/li&gt;&lt;li&gt;Jadi Overidding kerat kaitannya dengan inheritance (pewarisan)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Contoh lain:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double r;&lt;/p&gt; &lt;p&gt;Lingkaran(double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;this.r = r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas(double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;this.r = r;&lt;br /&gt;return Math.PI*this.r*this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;br /&gt;class Tabung extends Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double h;&lt;/p&gt; &lt;p&gt;Tabung() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//konstruktor kelas turunan, ada super() dan diisi nilai awal&lt;br /&gt;super(0);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;double Luas(double r) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//overriding (method and parameter sama)&lt;br /&gt;this.r = r;&lt;br /&gt;return Math.PI * this.r * this.r * this.h;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;NB:&lt;/p&gt; &lt;ul&gt;&lt;li&gt; Class lingkaran melakukan overloading method Luas (beda signature)&lt;/li&gt;&lt;li&gt;Class tabung mengextends class lingkaran&lt;/li&gt;&lt;li&gt;Class tabung meng-override method Luas hasil dari overload. Jadi kita juga biosa mengoverride method hasil overloading juga&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;contoh lain:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class Sepeda{ //Sepeda.java&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;int kecepatan = 0;&lt;br /&gt;int gir = 0;&lt;br /&gt;// method&lt;br /&gt;void ubahGir(int pertambahanGir) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;gir= gir+ pertambahanGir;&lt;br /&gt;System.out.println(”Gir:” + gir);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;br /&gt;void tambahKecepatan(int pertambahanKecepatan) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;kecepatan = kecepatan+ pertambahanKecepatan;&lt;br /&gt;System.out.println(”Kecepatan:” + kecepatan);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt; &lt;p&gt;class SepedaGunung extends Sepeda { //SepedaGunung.java&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;int setSadel;&lt;br /&gt;void ubahGir(int pertambahanGir){&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;gir= 2*(gir+ pertambahanGir );&lt;br /&gt;System.out.println(”Gir:” + gir);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt; &lt;p&gt;class SepedaGunungBeraksi { //SepedaGunungBeraksi.java&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;public static void main(String[] args) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;// Membuat object&lt;br /&gt;SepedaGunung sepedaku = new sepedaGunung();&lt;br /&gt;// Memanggil method di object&lt;br /&gt;sepedaku.tambahKecepatan(10);&lt;br /&gt;sepedaku.ubahGir(2);&lt;br /&gt;sepedaku.setSadel(20);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://ananksim.blogspot.com/feeds/740992979633140959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ananksim.blogspot.com/2009/10/polimorphism.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/740992979633140959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/740992979633140959'/><link rel='alternate' type='text/html' href='http://ananksim.blogspot.com/2009/10/polimorphism.html' title='Polimorphism'/><author><name>NANANG</name><uri>http://www.blogger.com/profile/14034668181797145003</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hTpYSbqP2x2y-UzHq7dIft9f3WZbidltypRiQ4XrUtFwia-_51DLmSsSwPiyVFZeCFKyNhiP0yGRBMYBY6n91XKuw1Cm2lqYlkpnw9LThd0kFnaWdNfK00EHc2W74A/s220/nanang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364476326115322705.post-1642318043407962614</id><published>2009-10-18T07:01:00.001-07:00</published><updated>2009-10-18T08:24:37.414-07:00</updated><title type='text'>Inheritance (Pewarisan)</title><content type='html'>&lt;div class=&quot;snap_preview&quot;&gt;&lt;p&gt;Dalam Java, semua class, termasuk class yang membangun Java API, adalah subclasses dari superclass Object. Contoh hirarki class diperlihatkan di bawah ini. Beberapa class di atas class utama dalam hirarki class dikenal sebagai superclass. Sementara beberapa class di bawah class pokok dalam hirarki class dikenal sebagai subclass dari class tersebut.&lt;/p&gt; &lt;p&gt;Dengan kata lain:&lt;/p&gt; &lt;p&gt;* Super (super class)&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;Bisa disebut juga dengan induk.&lt;br /&gt;Misalnya class ORTU adalah super class yang mewarisi ke class ANAK&lt;br /&gt;Nah, karena mewarisi berarti ORTU bertindak sebagai super class&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span id=&quot;more-54&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;* Sub (sub class)&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;Bisa disebut dengan anak&lt;br /&gt;Misalnya class ANAK diwarisi oleh class ORTU&lt;br /&gt;Artinya anak adalah sub class dari class ORTU (super class)&lt;/p&gt; &lt;p&gt;Pewarisan adalah keuntungan besar dalam pemrograman berbasis object karena suatu sifat atau method didefinisikan dalam superclass, sifat ini secara otomatis diwariskan dari semua subclasses. Jadi, kode method dapat dituliskan hanya sekali dan dapat digunakan oleh semua subclass. Subclass hanya butuh mengimplementasikan perbedaannya sendiri dan induknya.&lt;/p&gt; &lt;p&gt;Misalnya class ORTU mempunyai mempunyai variabel dan method dan diturunkan ke sub classnya (misal: class ANAK). Berarti class ANAK mempunyai semua variabel dan method yang dimiliki oleh class ORTU.&lt;/p&gt; &lt;p&gt;Lalu bagaimana caranya? Caranya adalah dengan menggunakan kata kunci extends. Bentuk umum proses inheritance adalah&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class &lt;sub_class&gt; extends &lt;super_class&gt; {&lt;br /&gt;&lt;program&gt;;&lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Contoh:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class ANAK extends ORTU {&lt;/p&gt; &lt;p&gt;}&lt;br /&gt;// class anak sebagai subclass yang mendapat warisan dari class ORTU&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Contoh lain:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;// Lingkaran.java&lt;br /&gt;class Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double r;&lt;br /&gt;double Luas() {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;return Math.PI * this.r * this.r;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt; &lt;p&gt;// Silinder.java&lt;br /&gt;class Silinder extends Lingkaran {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;double h;&lt;br /&gt;double Volume() {&lt;br /&gt;return Math.PI * this.r * this.r * this.h ;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Di dalam Java semua class yang kita buat sebenarnya adalah turunan atau subclass dari class Object. Class Object merupakan class tertinggi dari semua hirarki class dalam Java&lt;/p&gt;&lt;div class=&quot;snap_preview&quot;&gt;&lt;p&gt;Latihan berikut untuk mengenalkan konsep dari inheritance yaitu suatu class dapat mewariskan atibut dan method kepada claas lain (subclass)&lt;/p&gt; &lt;p&gt;berikut kita analisis source code berikut:&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;strong&gt;Sepeda.java&lt;/strong&gt;&lt;/span&gt; (class tertinggi atau superclass)&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class Sepeda{&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;//mendeklarasikan variabel&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;int kecepatan = 0;&lt;br /&gt;int gir = 0;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method ubahGir dan parameter pertambahanGir yang bertipe integer&lt;br /&gt;void ubahGir(int pertambahanGir) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;gir= gir+ pertambahanGir;&lt;br /&gt;System.out.println(”Gir:” + gir);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method tambahKecepatan dan parameter pertambahanKecepatan yang bertipe integer&lt;br /&gt;void tambahKecepatan(int pertambahanKecepatan) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;kecepatan = kecepatan+ pertambahanKecepatan;&lt;br /&gt;System.out.println(”Kecepatan:” + kecepatan);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;span id=&quot;more-87&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(0, 0, 128);&quot;&gt;SepedaGunung.java&lt;/span&gt;&lt;/strong&gt; adalah class yang &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;strong&gt;mewarisi&lt;/strong&gt; &lt;/span&gt;class &lt;strong&gt;&lt;span style=&quot;color: rgb(0, 0, 128);&quot;&gt;Sepeda.java&lt;/span&gt;&lt;/strong&gt;. dengan keyword &lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;extends &lt;/span&gt;&lt;/strong&gt;kita dapat menggunakan method dan atribut yang ada pada class Sepeda.java&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;SepedaGunung.java&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class SepedaGunung extends Sepeda {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;//mendeklarasikan atribut&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;int setSadel;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method setSadel dan parameter nilaiSadel yang bertipe integer&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;public void setSadel(int nilaiSadel) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;setSadel = nilaiSadel;&lt;br /&gt;System.out.println(“Tinggi Sadel:”+setSadel);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(0, 0, 128);&quot;&gt;SepedaGunungBeraksi.java&lt;/span&gt;&lt;/strong&gt; digunakan untuk mengeksekusi atau &lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;memanggil method&lt;/span&gt;&lt;/strong&gt; yang ada pada class Sepeda.java dan class SepedaGunung.java&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;SepedaGunungBeraksi.java&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class SepedaGunungBeraksi {&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;public static void main(String[] args) {&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;// Membuat object&lt;br /&gt;SepedaGunung sepedaku = new sepedaGunung();&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;// Memanggil method dan memberikan nilai parameter pada masing-masing method diobject&lt;br /&gt;sepedaku.tambahKecepatan(10);&lt;br /&gt;sepedaku.ubahGir(2);&lt;br /&gt;sepedaku.setSadel(20);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;dengan cara yang sama, kita akan mengembangkan program java diatas. kita akan membuat class &lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;MobilBMW&lt;/span&gt;&lt;/strong&gt; yang merupakan inherit dari class &lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;Mobillengkap&lt;/span&gt;&lt;/strong&gt; dengan menambahkan beberapa method &lt;strong&gt;&lt;span style=&quot;color: rgb(0, 0, 128);&quot;&gt;nontonTV()&lt;/span&gt;&lt;/strong&gt; yang isinya menampilkan tulisan &lt;strong&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;tv dihidupkan&lt;/span&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;tv mencari chanel, tv menampilkan gambar&lt;/span&gt;&lt;/strong&gt;. buat class MobilBMWBeraksi yang memanggil method &lt;strong&gt;&lt;span style=&quot;color: rgb(0, 0, 128);&quot;&gt;nontonTV(), hidupkanMobil(), matikanMobil(), dan ubahGigi()&lt;/span&gt;&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;jawab:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;terlebih dahulu kita buat &lt;a href=&quot;http://materijava.wordpress.com/2009/10/08/latihan-soal-1/#more-71&quot;&gt;class &lt;/a&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;a href=&quot;http://materijava.wordpress.com/2009/10/08/latihan-soal-1/#more-71&quot;&gt;Mobillengkap.java&lt;/a&gt; &lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;yang sebelumnya sudah kita buat di artikel sebelumnya&lt;/span&gt;:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class mobilLengkap{ //penulisan class harus sama dengan nama filenya&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;String warna ;&lt;br /&gt;int tahunProduksi;&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt; &lt;/p&gt;&lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method printMobil&lt;br /&gt;void printMobil(){&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;System.out.println(”warna:”+warna);&lt;br /&gt;System.out.println(”Tahun:”+tahunProduksi);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt; &lt;/p&gt;&lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method hidupkanMobil&lt;/p&gt; &lt;p&gt;void hidupkanMobil(){&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;System.out.println(”mobil sudah hidup”);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt; &lt;/p&gt;&lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method matikanMobil&lt;/p&gt; &lt;p&gt;void matikanMobil(){&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;System.out.println(”mobil sudah mati”);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt; &lt;/p&gt;&lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method jalankanMobil&lt;/p&gt; &lt;p&gt;void jalankanMobil(){&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;System.out.println(”mobil sudah berjalan”);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;selanjutnya kita buat class &lt;strong&gt;&lt;span style=&quot;color: rgb(0, 0, 128);&quot;&gt;MobilBMW.java&lt;/span&gt;&lt;/strong&gt; yang &lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;mengextends atau mewarisi&lt;/span&gt;&lt;/strong&gt; class &lt;span style=&quot;color: rgb(0, 0, 128);&quot;&gt;&lt;strong&gt;MobilLengkap.java&lt;/strong&gt;&lt;/span&gt; yang ditambahi dengan method nontonTV().&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;MobilBMW.java&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;class MobilBMW extends MobilLengkap{ /*perintah extends digunakan untuk mewarisi atribut dan method yang ada pada class mobilLengkap*/&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;//membuat method nontonTV()&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;public void nontonTV(){&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;System.out.println(”TV dihidupkan”);&lt;br /&gt;System.out.println(”TV mencari Chanel”);&lt;br /&gt;System.out.println(”TV menampilkan gambar”);&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;selanjutnya kita buat file MobilBMWBeraksi.java untuk memanggil method nontonTV(), hidupkanMobil(), matikanMobil(), dan ubahGir().&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;MobilBMWBeraksi.java&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;public class MobilBMWBeraksi{&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;public static void main(String[] args){&lt;/p&gt; &lt;p style=&quot;padding-left: 60px;&quot;&gt;//membuat object&lt;br /&gt;MobilBMW mobilku= new MobilBMW();&lt;/p&gt; &lt;p&gt;//memanggil method&lt;br /&gt;mobilku.nontonTV();&lt;br /&gt;mobilku.hidupkanMobil();&lt;br /&gt;mobilku.matikanMobil();&lt;br /&gt;mobilku.ubahGigi();&lt;/p&gt; &lt;p style=&quot;padding-left: 30px;&quot;&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ananksim.blogspot.com/feeds/1642318043407962614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ananksim.blogspot.com/2009/10/inheritance-pewarisan.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/1642318043407962614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/1642318043407962614'/><link rel='alternate' type='text/html' href='http://ananksim.blogspot.com/2009/10/inheritance-pewarisan.html' title='Inheritance (Pewarisan)'/><author><name>NANANG</name><uri>http://www.blogger.com/profile/14034668181797145003</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hTpYSbqP2x2y-UzHq7dIft9f3WZbidltypRiQ4XrUtFwia-_51DLmSsSwPiyVFZeCFKyNhiP0yGRBMYBY6n91XKuw1Cm2lqYlkpnw9LThd0kFnaWdNfK00EHc2W74A/s220/nanang.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364476326115322705.post-4268367058121394803</id><published>2009-10-18T07:01:00.000-07:00</published><updated>2009-10-18T07:16:41.114-07:00</updated><title type='text'>JAVA FUNDAMENTAL</title><content type='html'>&lt;div class=&quot;snap_preview&quot;&gt;&lt;p&gt;OPERATOR&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Operator adalah suatu simbol yang digunakan untuk operasi tertentu. JAVA mempunyai banyak jenis operator antara lain:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Assignment&lt;/li&gt;&lt;li&gt;Aritmatika&lt;/li&gt;&lt;li&gt;Hubungan&lt;/li&gt;&lt;li&gt;Logika&lt;/li&gt;&lt;li&gt;Bitwise&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Klasifikasi lain tentang Operator (berdasarkan jumlah operand):&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Operator Unary: Melibatkan satu operand. Contoh: -4.00&lt;/li&gt;&lt;li&gt;Operator binary: Melibatkan dua operand. Contoh: 2 + 3&lt;/li&gt;&lt;li&gt;Operator tertiary: Melibatkan tiga operand. Contoh: 23 ? SI : NOSI&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;span id=&quot;more-107&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;img title=&quot;operator&quot; src=&quot;http://bernazlionk.files.wordpress.com/2009/01/operator.jpg?w=510&amp;amp;h=329&amp;amp;h=329&quot; alt=&quot;operator&quot; width=&quot;510&quot; height=&quot;329&quot; /&gt;&lt;/p&gt; &lt;p style=&quot;text-align: left;&quot;&gt;Operator yang mempunyai jenjang lebih kecil akan dikerjakan lebih dulu&lt;/p&gt; &lt;p&gt;contohnya:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;Total=2+3*8;&lt;br /&gt;/*Total=26&lt;/p&gt; &lt;p&gt;karena * mempunyai jenjang lebih dulu&lt;br /&gt;yang dikerjakan 3*8 dulu baru kemudian ditambahkan dengan 2*/&lt;/p&gt;&lt;/blockquote&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;Operator Assignment&lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;img title=&quot;operator-assignment&quot; src=&quot;http://bernazlionk.files.wordpress.com/2009/01/operator-assignment.jpg?w=510&amp;amp;h=327&amp;amp;h=327&quot; alt=&quot;operator-assignment&quot; width=&quot;510&quot; height=&quot;327&quot; /&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;Operator Aritmatika&lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;img title=&quot;operator-aritmatika&quot; src=&quot;http://bernazlionk.files.wordpress.com/2009/01/operator-aritmatika.jpg?w=510&amp;amp;h=201&amp;amp;h=201&quot; alt=&quot;operator-aritmatika&quot; width=&quot;510&quot; height=&quot;201&quot; /&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;Operator Hubungan&lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;img title=&quot;operator-hubungan&quot; src=&quot;http://bernazlionk.files.wordpress.com/2009/01/operator-hubungan.jpg?w=510&amp;amp;h=188&amp;amp;h=188&quot; alt=&quot;operator-hubungan&quot; width=&quot;510&quot; height=&quot;188&quot; /&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;Operator Logika&lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;img title=&quot;operator-logika&quot; src=&quot;http://bernazlionk.files.wordpress.com/2009/01/operator-logika.jpg?w=510&amp;amp;h=181&amp;amp;h=181&quot; alt=&quot;operator-logika&quot; width=&quot;510&quot; height=&quot;181&quot; /&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;Operator Bitwise&lt;/strong&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt;&lt;img title=&quot;operator-bitwise&quot; src=&quot;http://bernazlionk.files.wordpress.com/2009/01/operator-bitwise.jpg?w=510&amp;amp;h=212&amp;amp;h=212&quot; alt=&quot;operator-bitwise&quot; width=&quot;510&quot; height=&quot;212&quot; /&gt;&lt;/p&gt; &lt;p style=&quot;text-align: center;&quot;&gt; &lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;Operator Ternary&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Biasa disebut dengan Operator Kondisi. Operator ini membutuhkan 3 argumen&lt;br /&gt;Bentuk Umum:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;&lt;ekspresi_kondisi&gt; ? &lt;nilai_1&gt; : &lt;nilai_2&gt;;&lt;br /&gt;//Nilai_1 untuk nilai yang benar&lt;br /&gt;//Nilai_2 untuk nilai yang salah&lt;/p&gt;&lt;/blockquote&gt; &lt;p style=&quot;text-align: left;&quot;&gt;Contoh:&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;String Nilai = IPK &lt;&gt;&lt;/blockquote&gt; &lt;p&gt;sumber: http://bernazlionk.wordpress.com/2009/01/18/java-operator/&lt;/p&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ananksim.blogspot.com/feeds/4268367058121394803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ananksim.blogspot.com/2009/10/java-fundamental.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/4268367058121394803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/4268367058121394803'/><link rel='alternate' type='text/html' href='http://ananksim.blogspot.com/2009/10/java-fundamental.html' title='JAVA FUNDAMENTAL'/><author><name>NANANG</name><uri>http://www.blogger.com/profile/14034668181797145003</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hTpYSbqP2x2y-UzHq7dIft9f3WZbidltypRiQ4XrUtFwia-_51DLmSsSwPiyVFZeCFKyNhiP0yGRBMYBY6n91XKuw1Cm2lqYlkpnw9LThd0kFnaWdNfK00EHc2W74A/s220/nanang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364476326115322705.post-4052599554628555033</id><published>2009-09-12T22:59:00.000-07:00</published><updated>2009-09-12T23:01:28.901-07:00</updated><title type='text'></title><content type='html'>&lt;h3 class=&quot;post-title entry-title&quot;&gt; &lt;a href=&quot;http://hariy2009.blogspot.com/2009/09/tugas-mata-kuliah-pemrograman.html&quot;&gt;Tugas mata kuliah &quot;Pemrograman Berorientasi Obyek&quot;&lt;/a&gt; &lt;/h3&gt;   &lt;p style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot; class=&quot;MsoNormal&quot; align=&quot;center&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;PEMROGRAMAN BERORIENTASI OBJEK&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot; class=&quot;MsoNormal&quot; align=&quot;center&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-indent: 18pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Belajar PBO, berarti harus membiasakan diri berpikir secara kelas dan objek setiap menghadapi masalah.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Contoh :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Buatlah program untuk menghitung keliling lingkaran dari masukan jari-jarinya !&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Masalah tersebut bila disajikan dengan pendekatan kelas dan objek, harus direvisi sebagai berikut :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Buatlah kelas lingkaran yang memiliki tanggungjawab mengetahui jari-jarinya dan kelilingnya, lingkaran tersebut dapat melakukan aksi mengembang dan berkerut sesuai dengan panjang jari-jarinya.&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;&quot;&gt;&lt;table vspace=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; hspace=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border: medium none rgb(212, 208, 200); padding: 0cm; background-color: transparent;&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;letter-spacing: -0.05pt; color: black; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Bahasa java yang telah dirilis :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;1. Product Sun Microsystem : j2se, j2me, j2ee&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;2. Product Borland : JBuilder&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;3. Product Microsoft : Visual J&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-indent: 18pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Spesifikasi j2ee antara lain JDBC, JDOM (untuk XML),&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;Remote Method Invocation, Enterprise Java Beans, Java Messaging, Java Server Pages, Java Servlet, Socket Programming, dan SQLJ. Java/Standard Development Kit (JDK/SDK) merupakan alat-alat utama bagi programmer untuk membuat dan menjalankan java. Development Kit dapat didownload di :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;http://java.sun.com/product/JDK/index.html&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;atau&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;http://java.sun.com/j2se/1.5/index.html&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;atau&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;http://java.sun.com/cgi-bin/java-ports.cgi&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;&quot;&gt;&lt;table vspace=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; hspace=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border: medium none rgb(212, 208, 200); padding: 0cm; background-color: transparent;&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;letter-spacing: -0.05pt; color: black; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-indent: 13.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;Komponen JDK antara lain compiler(javac), interpreter(java) disebut juga java virtual machine atau java runtime environment, applet viewer(appletviewer), debugger(jdb), java class library(jcl), header dan stub generator(javah), dan yang paling penting yaitu java documentation(javadoc). Penjelasan penggunaan komponen JDK :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;1. Kompilator (javac) Bertugas untuk melaksanakan kompilasi&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;*.java menjadi *.class&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Syntax umum : javac nama.java&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;2. Interpreter (java) Bertugas untuk menjalankan bytecode (*.class)&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Syntax umum : java nama.class&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;3. Applet Viewer Digunakan untuk menjalanakan applet viewer, namun sekarang sudah digantikan browser.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Syntax umum : appletviewer nama.html&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;4. Java Debugger Bertugas untuk melakukan debugging aplikasi java. &lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Syntax umum : jdb option&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;&quot;&gt;&lt;table vspace=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; hspace=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border: medium none rgb(212, 208, 200); padding: 0cm; background-color: transparent;&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt; text-align: justify;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;letter-spacing: -0.05pt; color: black; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;4&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;5. Java Class File Diassembler (javap) Bertugas membuat daftar method dan attribute public dari suatu kelas.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Syntax : javap namaKelas&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;6. Java Header and Stub Generator Bertugas menerjemahkan bahasa yang ditulis dalam bahasa java menjadi bahasa C.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Syntax umum : javah namaKelas&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;7. Java Documentation Generator Menampilkan pustaka kelas, interface, constructor, dan method standard yang telah dibuat vendor.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Dari hasil instalasi, dokumentasi ini dapat dilihat di C:\java\docs\api\index.html atau C:\Program Files\NetBeans3.6\docs\junit\index.html&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;8. Source Code Java API Source code ini dapat diperoleh dari file src.zip.&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;&quot;&gt;&lt;table vspace=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; hspace=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border: medium none rgb(212, 208, 200); padding: 0cm; background-color: transparent;&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;letter-spacing: -0.05pt; color: black; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;5&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Untuk pemrogram pemula lingkungan pemrograman java dapat diringkas menjadi :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;1. Editing source code menggunakan editor teks.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;2. Compiling menggunakan keyword javac melalui command promp (dapat juga dari editor teks).&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 40.5pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;3. Executing menggunakan :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;a. Keyword java melalui command prompt (dapat juga dari editor teks)&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 54pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;b. Browser atau applerviewer untuk applet.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Token&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 18pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Token adalah elemen terkecil di program yang masih memiliki arti. Ada 5 token dalam bahasa java yaitu identifier, keyword, literal dan tipe data, operator, serta separator. &lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Identifier&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt 18pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Identifier adalah token yang merepresentasikan nama sesuatu. Sesuatu tersebut adalah variabel, atau konstanta, atau attribute, atau method, atau kelas, atau package, atau interface, atau nama file, dan lain-lain.&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;&quot;&gt;&lt;table vspace=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; hspace=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border: medium none rgb(212, 208, 200); padding: 0cm; background-color: transparent;&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;letter-spacing: -0.05pt; color: black; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;6&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Keyword&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Kata kunci digunakan untuk suatu tujuan tertentu. Ada 51 keyword dalam java yaitu :&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;abstract continue for new switch boolean default goto&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;null&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;synchronized break do&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;if package this byte&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;double implements private threadsafe byvalue else import protected throw case&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;extends instanceof public&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;throws catch false&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;int return transient car&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;final interface short true class finally long&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;static try const float native&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;super void while&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Literal dan Tipe Data Primitif&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;Literal adalah nilai variabel/attribute atau nilai konstanta atau nilai objek data. Ada tiga besaran literal dalam java yaitu angka, karakter, dan string. Angka terdiri dari byte, short, int, long, float, double, dan boolean (dianggap angka true = 1 atau false = 0)&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://ananksim.blogspot.com/feeds/4052599554628555033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ananksim.blogspot.com/2009/09/tugas-mata-kuliah-pemrograman.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/4052599554628555033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/4052599554628555033'/><link rel='alternate' type='text/html' href='http://ananksim.blogspot.com/2009/09/tugas-mata-kuliah-pemrograman.html' title=''/><author><name>NANANG</name><uri>http://www.blogger.com/profile/14034668181797145003</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hTpYSbqP2x2y-UzHq7dIft9f3WZbidltypRiQ4XrUtFwia-_51DLmSsSwPiyVFZeCFKyNhiP0yGRBMYBY6n91XKuw1Cm2lqYlkpnw9LThd0kFnaWdNfK00EHc2W74A/s220/nanang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-364476326115322705.post-3618517353142847910</id><published>2009-09-12T22:51:00.000-07:00</published><updated>2009-09-12T22:58:51.539-07:00</updated><title type='text'>BELAJAR JAVA</title><content type='html'>&lt;span&gt;PEMROGRAMAN BERORIENTASI OBJEK  Belajar PBO, berarti harus membiasakan diri berpikir secara kelas dan objek setiap menghadapi masalah. Contoh : Buatlah program untuk menghitung keliling lingkaran dari masukan jari-jarinya ! Masalah tersebut bila disajikan dengan pendekatan kelas dan objek, harus direvisi sebagai berikut : Selengkapnyaa………&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;h3 class=&quot;post-title entry-title&quot;&gt; &lt;a href=&quot;http://hariy2009.blogspot.com/2009/09/tugas-kuliah.html&quot;&gt;Tugas Kuliah&lt;/a&gt; &lt;/h3&gt;   Membuat dan Memanggil Method&lt;br /&gt;&lt;br /&gt;Class mobillengkap&lt;br /&gt;{&lt;br /&gt;  String warna;&lt;br /&gt;  Int tahunproduksi;&lt;br /&gt;  Int mati =1;&lt;br /&gt;  Int ubahgigi = 3;&lt;br /&gt;&lt;br /&gt;  Void printmobil()&lt;br /&gt;  {&lt;br /&gt;   System.out.println(“Warna :”+warna);&lt;br /&gt;   System.out.println(“Tahun Produksi :”+tahunproduksi);&lt;br /&gt;  }&lt;br /&gt;  Void nyala()&lt;br /&gt;  {&lt;br /&gt;   System.out.println(“Mesin mobil menyala……”);&lt;br /&gt;   Off = 0&lt;br /&gt;  }&lt;br /&gt;  Void mati()&lt;br /&gt;  {&lt;br /&gt;   Off = 1       &lt;br /&gt;   System.out.println(“Mesin mobil dimatikan……”);&lt;br /&gt;  }&lt;br /&gt;  Void ubahgigi()&lt;br /&gt;  {&lt;br /&gt;   If (mati = 1)   &lt;br /&gt;   {&lt;br /&gt;    System.out.println(“Gigi persneling tidak bisa di ubah………”);&lt;br /&gt;    System.out.println(“Mesin mobil tidak menyala………..”);&lt;br /&gt;   }&lt;br /&gt;   Else&lt;br /&gt;    System.out.println(“Gigi persneleng ditambah 1.”);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Public class mobillengkapberaksi&lt;br /&gt;{&lt;br /&gt;  Public static void main(String[]args)&lt;br /&gt;  {&lt;br /&gt;   /* Membuat object */&lt;br /&gt;&lt;br /&gt;   Mobil2mobilku = new mobil2();&lt;br /&gt;&lt;br /&gt;   /* Memanggil atribut dan memberi nilai */&lt;br /&gt;&lt;br /&gt;   Mobilku.warna = “Hitam”;&lt;br /&gt;   Mobilku.tahunproduksi = 2006;&lt;br /&gt;   Mobilku.printmobil();&lt;br /&gt;  }&lt;br /&gt;}</content><link rel='replies' type='application/atom+xml' href='http://ananksim.blogspot.com/feeds/3618517353142847910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ananksim.blogspot.com/2009/09/belajar-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/3618517353142847910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/364476326115322705/posts/default/3618517353142847910'/><link rel='alternate' type='text/html' href='http://ananksim.blogspot.com/2009/09/belajar-java.html' title='BELAJAR JAVA'/><author><name>NANANG</name><uri>http://www.blogger.com/profile/14034668181797145003</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hTpYSbqP2x2y-UzHq7dIft9f3WZbidltypRiQ4XrUtFwia-_51DLmSsSwPiyVFZeCFKyNhiP0yGRBMYBY6n91XKuw1Cm2lqYlkpnw9LThd0kFnaWdNfK00EHc2W74A/s220/nanang.jpg'/></author><thr:total>0</thr:total></entry></feed>