Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Clase4{
- public static void main(String[] args){
- //objects Pantalla
- //received paramater from the constructor on Class Pantalla
- Pantalla pantalla = new Pantalla(5);
- Pantalla pantalla2 = new Pantalla(5);
- //False because even though they have the same data they are different
- System.out.println(pantalla == pantalla2)
- //Objects Celular iPhone and Galaxy
- /* Question: why did we wrote pantalla? I know that the String is there
- because of the constructor on the Celular Class, String modelo but what's the
- Pantalla pantalla? */
- Celular iPhone = new Celular(" iPhone X ", pantalla);
- Celular galaxy = new Celular(" Galaxy S9 ", pantalla);
- /* Question: From where does the iPhone.getPantalla() comes from?
- what are we doing here? */
- System.out.println(pantalla == iPhone.getPantalla())
- //Here we are using the objects with the behaviours, nothing complicated
- pantalla.encenderse();
- pantalla2.encenderse();
- //Third object but what does the iPhone.getPantalla(); do?
- //If it's an object why we didn't wrote new?
- Pantalla pantalla3 = iPhone.getPantalla();
- //Apart from whatever iPhone.getPantalla() does we added the
- //.encenderse(); so it does whatever is supposed to do?
- pantalla3.encenderse();
- //Here I have no idea what's going on...
- iPhone.getPantalla().encenderse();
- System.out.println(iPhone.getPantalla().getTamanio());
- System.out.println(pantalla == pantalla3);
- galaxy.getPantalla().romper();
- System.out.println(pantalla.getTamanio());
- System.out.println(iPhone.getPantalla().getTamanio());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement