Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Created January 12, 2020 12:40
Show Gist options
  • Save uncoded-ro/ce28a5011ded3a5afc2559e0431ba1ab to your computer and use it in GitHub Desktop.
Save uncoded-ro/ce28a5011ded3a5afc2559e0431ba1ab to your computer and use it in GitHub Desktop.
class Carte {
String titlu;
String autor;
Carte() {
titlu = " ";
autor = " ";
}
Carte(String titlu, String autor) {
this.titlu = titlu;
this.autor = autor;
}
void fisaCarte() {
System.out.println("Titlu: " + titlu);
System.out.println("Autor: " + autor);
}
void fisaCarte(int id) {
System.out.println("Id: " + id);
System.out.println("Titlu: " + titlu);
System.out.println("Autor: " + autor);
}
public static void main(String[] args) {
Carte c1 = new Carte("Morometii", "Marin Preda");
Carte c2 = new Carte("Fratii Jderi", "Mihail Sadoveanu");
c1.fisaCarte();
c1.fisaCarte(1);
c2.fisaCarte(2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment