Trashegimia dhe polimorfizmi.  Tipet e programeve JAVA

Trashegimia (Inheritance) – Aftesia per te krijuar klasa qe ndajne atributet dhe metodat e klases ekzistuese, por me vecori te tjera specifike. 

Trashegima ndihmon ne kuptimin e objekteve te botes reale. Ju mund te ndertoni klasa te bazuara ne klasat ekzistuese dhe te perqendroheni ne vecorite e reja qe shtohen ne klasen e re.

Polimorfizmi eshte nje koncept tjeter i rendesishem ne terminologjine e OOP.  Fjale per fjale polimorfizem do te thote “ shume forma ” – dhe pershkruan vecorine e gjuheve qe lejojne te njejten fjale ose simbol te interpretohet korrekt ne situata te ndryshme bazuar ne kuptimin e saj.

Psh: Fjala “run” interpretohet ndryshe ne sport, biznes, programim.

Po keshtu programet ne programimin e orientuar me objekte jane shkruar ne menyre te tille qe shume fjale si “print” ose “save” te perdoren ndryshe, bazuar ne kontekstin e tyre.

Polimorfizmi perdoret më me eficence ne GUI (graphical user interface).

p.sh. metodat setFont dhe setText mund te perdoren per disa objekte, psh ne Button, TextField, etj.

Tipet e programeve Java:

  1. Applets – programe qe nderfuten ne nje web page
  2. Applications – Programe te vecuara (stand alone), te cilat mund te ndahen ne:

a)  console applications qe suportojne afishimin e karaktereve ne nje dritare DOS, dhe

b)  windowed applications, te cilat krijojne nje GUI me elemente si menu, toolbars dhe dritare dialoguese.