Pewarisan

Jumat, 02 Desember 2011 0 komentar

 Pewarisan
Salah satu kelebihan pemrograman berorientasi Objek adalah penggunaan ulang kode-kode yang telah dibuat. Pewarisan adalah salah satu cara diantaranya.
Sebagai contoh, kelas Manusia diturunkan menjadi kelas Mahasiswa.


class Mahasiswa extends Manusia{
//konstruktor Mahasiswa
Mahasiswa(String n){
//memanggil konstruktor Manusia
super(n);
}
//method bentukan baru...
void kerja(){
System.out.println("belajar...belajar...");
}
}


Angga adalah seorang Mahasiswa keturunan Manusia, setelah dia kerja, dia makan.
class Angga{
public static void main(String args[]){
Mahasiswa angga = new Mahasiswa("Angga Darmawan");
System.out.println("Nama : "+angga.tampilkanNama());
angga.kerja();
angga.makan();
}
}
Hasil Compile dan Runningnya :
C:\modultutorialjava>javac Angga.java
C:\ modultutorialjava>java Angga
Nama : Angga Darmawan
belajar...belajar...
hem...enyak..enyak..enyak...


Setelah object angga memberi tahu namanya, dia kerja dengan method khusus kelas Mahasiswa dan terakhir dia makan dengan method warisan dari kelas Manusia. Kelas turunan akan mewariskan atribut-atribut dan method-method baseclass/parentclass-nya.
Ketika angga makan, dia makan dengan method Manusia, tetapi ketika kerja, dia kerja dengan method baru yang didefinisikan khusus pada kelas Mahasiswa(“belajar…belajar…”), inilah yang disebut dengan method overriding.

Kelas dan Object

0 komentar

Kelas dan Object

Kelas dapat didefinisikan sebagai template/blue-print untuk membuat object. Kelas Pembuatan object dari kelas dikenal dengan nama instansiasi




Sebagai contoh, kita ambil kelas Manusia, mempunyai atribut nama. Selain itu, ia juga mempunyai method tampilkanNama , kerja, makan. Setiap kelas memiliki konstruktor yang berfungsi sebagai pembentuk object, ia juga berfungsi sebagai procedure yang pertama kali dijalankan ketika object bentukan terbentuk.
Dalam bahasa Java, dapat disajikan dengan code program berikut :

Sebagai contoh, kita ambil kelas Manusia, mempunyai atribut nama. Selain itu, ia juga mempunyai method tampilkanNama , kerja, makan. Setiap kelas memiliki konstruktor yang berfungsi sebagai pembentuk object, ia juga berfungsi sebagai procedure yang pertama kali dijalankan ketika object bentukan terbentuk.
Dalam bahasa Java, dapat disajikan dengan code program berikut :
class Manusia{ //Nama File : Manusia.java
String nama;
//konstruktor
Manusia(String n){
this.nama = n;
}
//function mengembalikan nilai nama
String tampilkanNama(){
return nama;
}
//procedure makan
void makan(){ System.out.println("hem...enyak..enyak..enyak...");
}

//procedure kerja
void kerja(){
System.out.println("kerja..kerja...kerja...");
}
}

Kita akan menginstansiasi kelas Manusia menjadi object samson.
class Samson{ // Nama File : Samson.java
public static void main(String args[]){
//instansiasi kelas Manusia menjadi object samson
Manusia samson=new Manusia("samsonasik");
System.out.println("Nama "+samson.tampilkanNama());
samson.makan();
}
}

}
Hasil Compile dan Runningnya nya :
C:\modultutorialjava>javac Samson.java
C:\modultutorialjava>java Samson
Nama samsonasik
hem...enyak..enyak..enyak...

Mohon dimengerti Sendiri, Terima Kasih

Attitude

Rabu, 19 Oktober 2011 0 komentar

Attitude (Psychology)

An attitude is a hypothetical construct that represents an individual's degree of like or dislike for something. Attitudes are generally positive or negative views of a person, place, thing, or event— this is often referred to as the attitude object. People can also be conflicted or ambivalent toward an object, meaning that they simultaneously possess both positive and negative attitudes toward the item in question.

Attitudes are judgments. They develop on the ABC model (affectbehavior, and cognition)[1]. The affective response is an emotional response that expresses an individual's degree of preference for an entity. The behavioral intention is a verbal indication or typical behavioral tendency of an individual. The cognitive response is a cognitive evaluation of the entity that constitutes an individual's beliefs about the object.[citation needed] Most attitudes are the result of either direct experience or observational learning from the environment.

Attitude Formation

Unlike personality, attitudes are expected to change as a function of experience. Tesser (1993) has argued that hereditary variables may affect attitudes - but believes that they may do so indirectly. For example, consistency theories, which imply that we must be consistent in our beliefs and values. The most famous example of such a theory is Dissonance-reduction theory, associated with Leon Festinger, although there are others, such as the balance theory.

Attitude Change

Attitudes can be changed through persuasion and we should understand attitude change as a response to communication. Experimental research into the factors that can affect the persuasiveness of a message include:
Target Characteristics: These are characteristics that refer to the person who receives and processes a message. One such trait is intelligence - it seems that more intelligent people are less easily persuaded by one-sided messages. Another variable that has been studied in this category is self-esteem. Although it is sometimes thought that those higher in self-esteem are less easily persuaded, there is some evidence that the relationship between self-esteem and persuasibility is actually curvilinear, with people of moderate self-esteem being more easily persuaded than both those of high and low self-esteem levels (Rhodes & Woods, 1992). The mind frame and mood of the target also plays a role in this process.
Source Characteristics: The major source characteristics are expertise, trustworthiness and interpersonal attraction or attractiveness. The credibility of a perceived message has been found to be a key variable here; if one reads a report about health and believes it came from a professional medical journal, one may be more easily persuaded than if one believes it is from a popular newspaper. Some psychologists have debated whether this is a long-lasting effect and Hovland and Weiss (1951) found the effect of telling people that a message came from a credible source disappeared after several weeks (the so-called "sleeper effect"). Whether there is a sleeper effect is controversial. Perceived wisdom is that if people are informed of the source of a message before hearing it, there is less likelihood of a sleeper effect than if they are told a message and then told its source.
Message Characteristics: The nature of the message plays a role in persuasion. Sometimes presenting both sides of a story is useful to help change attitudes.

Cognitive Routes: A message can appeal to an individual's cognitive evaluation to help change an attitude. In the central route to persuasion the individual is presented with the data and motivated to evaluate the data and arrive at an attitude changing conclusion. In the peripheral route to attitude change, the individual is encouraged to not look at the content but at the source. This is commonly seen in modern advertisements that feature celebrities. In some cases, physician, doctors or experts are used. In other cases film stars are used for their attractiveness.

 
Vengeance Andritera © 2011 | Designed by Bingo Cash, in collaboration with Modern Warfare 3, VPS Hosting and Compare Web Hosting