Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication2;
- /**
- *
- * @author student
- */
- public class JavaApplication2 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Profesor poo = new Profesor("poo","prof_poo");
- Student ghita = new Student(7,"ghita");
- System.out.println(poo);
- System.out.println(ghita);
- Persoana[] v = new Persoana[10];
- System.out.println("\n");
- v[0] = new Persoana("ada");
- v[1] = new Profesor("AA","insertname");
- v[2] = new Student(6,"bogdan");
- for(int i = 0; i< 3; i++)
- {
- System.out.println(v[i]);
- }
- System.out.println("\n");
- for(int i = 0; i < 3; i++)
- {
- if(v[i] instanceof Profesor)
- ((Profesor)v[i]).preda();
- if(v[i] instanceof Student)
- ((Student)v[i]).invata();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement