Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
soalan java.
25-01-2013, 06:07 PM,
Post: #1
soalan java.
PHP Code:
public void paint(Graphics g)
    {
        
super.paint(g); 

mengenai coding diatas boleh terangkan akan coding super.paint function dia macam mana or lebih mudah lagi kenapa perlu add super.paint?harap leh bantu. *
A word of advice,
don't promise only when u are HAPPY,
don't reply when u are ANGRY,
and don't decide when u are SAD.
Reply
25-01-2013, 06:17 PM,
Post: #2
RE: soalan java.
Nanti die lukis garis kot , kenape super tak tau la Hmm
Reply
26-01-2013, 07:56 AM,
Post: #3
RE: soalan java.
mungkin ni dapat tolong.. http://stackoverflow.com/questions/37673...er-in-java
Reply
14-04-2013, 10:14 PM,
Post: #4
RE: soalan java.
(25-01-2013, 06:07 PM)hard3 Wrote:
PHP Code:
public void paint(Graphics g)
    {
        
super.paint(g); 

mengenai coding diatas boleh terangkan akan coding super.paint function dia macam mana or lebih mudah lagi kenapa perlu add super.paint?harap leh bantu. *

cebisan coding di atas ialah satu function di dalam badan class file public void paint ialah void func di luar main super.paint(g); ialah panggilan class yang mempunyai objek super dan class paint. jarang sekali dilihat sebuah class di panggil dalam global function selalunya kita akan buat class file baru yang mempunyai main function untuk memanggil balik semua class kita bergantung kepada kehendak pengaturcara
[Image: Captu3re.jpg]
Reply
10-05-2013, 10:33 PM, (This post was last modified: 10-05-2013, 10:48 PM by JejakaPemalu.)
Post: #5
RE: soalan java.
Utk penerangan ringkas...

Ini contoh super class atau lebih dikenali parent class
Code:
public class Spray {
public string
  public void paint(Graphic g){
      //do something with graphic
  }
}
penggunaan parent ngn subclass
Code:
public class Cat {
  public void paint(Graphic g){
    super.paint(g);//akan call Spray->paint
  }
}
Btw contoh bleh negok kat http://docs.oracle.com/javase/tutorial/j...asses.html kat situ ada citer pasal subclassing nih..dimana bicycle adalah parent dan mountainbika sebagai subclass dia..

Tp kalu class method tuh public tak perlu kot nk create baru dalam subclass tuh...melainkan ada perubahan pada super class nya function atau protected function. tp protected method hanya bleh diakses oleh subclass ngn inheritance..
Dimana

Code:
public class Atok{  
    protected String nama = "Ahmad";
    public void namapenuh() {  
        System.out.println(nama);  
    }  
}
Atok -> namapenuh = "Ahmad"
Code:
public class Ayah extends Atok {  
   protected String nama = "Ali";
}
Ayah -> namapenuh = "Ali"
Code:
public class Kawan extends Atok {  

}
Kawan -> namapenuh = "Ahmad"

Lebih kurang lah tuh ringkasannya
However near and dear you are with wife, children, friends, families they are not you; they are outside of you. The inside of you says who is near. If nothing is said than you are foreveralone. Raise your iman and you shall not be foreveralone.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Soalan Java darknite 10 726 27-11-2013, 01:47 PM
Last Post: darknite
  [help] inputfile java please click me to know more Timon 0 364 14-04-2013, 10:02 PM
Last Post: Timon
  [problem]with java tcp client and server chat pron3t 1 512 26-02-2013, 01:21 PM
Last Post: muhaznar
  java API Timon 3 792 09-12-2012, 09:58 PM
Last Post: lamki
  java background music library Timon 0 417 09-12-2012, 05:21 PM
Last Post: Timon
  JAVA Layout... mana 1 feveret :P 127001 7 1,621 03-12-2012, 10:32 AM
Last Post: Wushipher
  Java | MS Excell 127001 5 995 29-07-2012, 12:41 AM
Last Post: lamki
  Tutorial: Menghubungkan SQLite Dengan Java s3m00t 4 1,218 25-07-2012, 02:40 AM
Last Post: s3m00t
  [java prob]guna user input dan methode erroe indintifier pron3t 2 640 22-04-2012, 07:56 PM
Last Post: pron3t
  [Tut]Java Array Name Ujang 2 708 19-04-2012, 03:07 PM
Last Post: pron3t

Forum Jump: