class Persoana {
// Instante variabile
String nume;
int varsta;
// Clasele pot contine
// 1. Date
// 2. Metode
}
public class App {
public static void main(String[] args) {
// Creaza un obiect al clasei Persoana
Persoana persoana1 = new Persoana();
persoana1.nume = "Mihai Alexandru";
persoana1.varsta = 30;
// Creaza al doilea obiect al clasei Persoana
Persoana persoana2 = new Persoana();
persoana2.nume = "Valentin Popescu";
persoana2.varsta = 20;
System.out.println(persoana1.nume);
System.out.println(persoana2.nume);
}
}
Output: Mihai Alexandru
Output: Valentin Popescu
Your write-up was an excellent reminder that there’s often additional to find out. Thanks for inspiring me to maintain developing and Mastering. https://sites.google.com/view/news-alert-fusion/best-roofing-companies-in-oshawa