l1fig2

l1fig2



public class Person {

private String narne;

private String id;

public Person(String aName,

narne = aName; ^_

id = anld;

}

public String getName ()    {

return narne;

}

public String getld() { return id;

}

}


String anld) {


The constructor.

It has the same name as the class name and does not have any result type.

It initializes the object and its attributes corresponding to the class fields.



Wyszukiwarka

Podobne podstrony:
l1fig2 public class Person { private String narne; private String id; public Person(String aNarne, n
JavaPOJO Kotlin M class Person { private String name; public Person(String name) this.name = name;}
w1rys2 public class Person { private Strine name: VVVVVVVVVW WWWWA pńvate Strinę
Komputery public class Komputery { private String marka; private Procesor procesor; privat
public class ShopBrowser { private static Document
19 p07 #include <stdio.h> class próba{ private: int *pi_Dane; public: próba(); -próba()
19 p08 #include <stdio.h> class próba { private: int *pi_Dane; public: próba(); -próba()
KlasyPo class Napis { private: const int m_cchTest; public: Napis(void) : m_cchTest(10){}}; Zgodnie
Po class Uwaga { private: int m_nLicznik; public: Uwaga(void) : m_nLicznik(1){} void UstawLicznik(in
}}; class NiePochodna{ private: int m_i; float m_f1; float m_f2; public: NiePochodnaO :
Java - obiekt jako monitor - przykład public class Pojemnik { private boolean pusty = true; public s
class Punkt{ private int x, y; public void Przesuń(int dx, int dy){ x += dx; y += dy;} public Punkt(

więcej podobnych podstron