String not adding to List - Java -


im having issue im sending string variables to,from,subject,message , attachment server , when go place them in list, message variable null! have outputted variable message, , comes supposed but, put in list. shows null.

private void dosend(string name) {     string = input.nextline();     string = input.nextline();     string subject = input.nextline();     string message = input.nextline();     string attachment = input.nextline();              system.out.println(to);     system.out.println(from);     system.out.println(subject);     system.out.println(message);     system.out.println(attachment);              // stores message, not mailbox             multiechoserver.mailbox.add(new email(to, from,subject, message, attachment));      system.out.println(mailbox);      system.out.println("message sent to: " + to);     system.out.println(message); } 

sample output

pj     // variable  dsds   // variable  subject  // subject variable  message  // message variable  [pj dsds subject null]  //this mailbox list  message sent to: pj //not part of error  message // message variable being outputted again see it changed 

i'm not sure if can me, let me know if need see more code thanks!

the email class

class email {     private string to, from, subject,  message, attachment;     int id;              public email(string ,string ,string subject, string message, string attachment)     {         this.to = to;         this.from = from;         this.subject = subject;         this.message = message;         this.message = attachment;     }      public int id()     {            return(id);     }      public string to()     {         return(to);     }      public string from()     {            return(from);     }      public string subject()     {         return(subject);     }      public string message()     {         return(message);     }     public string attachment()     {         return(attachment);     }      public string tostring()     {         return(to + " " + + " " + subject + " " + message + "" + attachment);     } } 

there problem in email class constructor. assigning message field twice message , attachment.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -