class Persoana {
// Instante variabile
String nume;
int varsta;
// Clasele pot contine
// 1. Date
// 2. Metode
void vorbeste() {
for(int i=0; i<3; i++) {
System.out.println("Numele meu este: " + nume + " si eu am " + varsta + " de ani ");
}
}
void spuneBuna() {
System.out.println("Buna!");
}
}
public class App {
public static void main(String[] args) {
// Creaza un obiect al clasei Persoana
Persoana persoana1 = new Persoana();
persoana1.nume = "Valentin Popescu";
persoana1.varsta = 30;
persoana1.vorbeste();
persoana1.spuneBuna();
// Creaza al doilea obiect al clasei Persoana
Persoana persoana2 = new Persoana();
persoana2.nume = "Ana Maria";
persoana2.varsta = 20;
persoana2.vorbeste();
persoana2.spuneBuna();
System.out.println(persoana1.nume);
System.out.println(persoana2.nume);
}
}
Output:
Numele meu este: Valentin Popescu si eu am 30 de ani
Numele meu este: Valentin Popescu si eu am 30 de ani
Numele meu este: Valentin Popescu si eu am 30 de ani
Buna!
Numele meu este: Ana Maria si eu am 20 de ani
Numele meu este: Ana Maria si eu am 20 de ani
Numele meu este: Ana Maria si eu am 20 de ani
Buna!
Valentin Popescu
Ana Maria
where to buy cialis online Recombinant gonadotropins are artificially created using recombinant DNA technology, a technology that joins together DNA from different organisms
Clinical improvement in response to antibiotics typically occurs in 48 to 72 hours purchase cialis 1 w w Solution Ophthalmic 1 mg ml Ointment Ophthalmic 0
where to buy cialis online forum The urinary sphincter at its proximal end relaxes to allow expulsion of urine
How did you know that I what blood pressure medications have lactose like the little ones tamoxifen withdrawal symptoms
Cool. I spent a long time looking for relevant content and found that your article gave me new ideas, which is very helpful for my research. I think my thesis can be completed more smoothly. Thank you.
why have you chosen this profession essay help how to write a dissertation abstract latino mba essay help
cialis precio cialis 5 mg 28 comprimidos en farmacias comprar cialis 5 mg