What does the cast "getFrom () [0]"

1

Good afternoon / Nights / Days

I'm a newbie in java, I've been working on it for a few months ... basically it's the first programming language I've dedicated myself to, I find myself with a doubt, which this kind of casting refers to

From.add(mensaje[i].getFrom()[0].toString()); 

I refer specifically to the part of the " getFrom () [0] ":,)

try
{      

            Session sesion = Session.getInstance(prop);
            Store store = sesion.getStore("pop3");
            //Obteniendo acceso al folder
            store.connect("pop.gmail.com", correo, contraseña);
            Folder folder = store.getFolder("INBOX");
            folder.open(Folder.READ_ONLY);
            //Obteniendo los mensajes del folder abierto anteriormente
            Message[] mensaje = folder.getMessages();
            //Extrayendo los asuntos al arraylist de strings 
            Subjects = new ArrayList<>();    
            From = new ArrayList<>();
            for (int i = 0; i < mensaje.length; i++) {
                Subjects.add(mensaje[i].getSubject());
                From.add(mensaje[i].getFrom()[0].toString());

            }
        } catch (NoSuchProviderException ex) {
        } catch (MessagingException ex) {
        }

    }
    
asked by Jesé Abraham Chavez Rivas 16.02.2018 в 18:39
source

1 answer

0

It is not a casting you are accessing an array, these arrays can be accessed by positions [0] , some positions can be string **, you can view them with a toString

I leave you with some theory:

  

An array (array) is a data structure that contains a collection of data of the same type, these are used as containers that store one or more related data, instead of declaring each data independently.

here something more complete Link

    
answered by 16.02.2018 / 19:09
source