i am so confused. i am trying to get the below code to work but it does'nt . I have two classes in two different .java files one called simpleemail and 1 called simpleemailtester. the simpleemailshould transfer the values of the input to the corresponding class attributes. but it's not working here is the code below can n e 1 help
Code:public class SimpleEmailTest { public static void main( String[] args ) { SimpleEmail Email; // email object to test. String whoFrom; // sender String whoTo; // recipient String subject; // subject matter String content; // text content of email public static final String notKnown = "Unknown"; email = new SimpleEmail(notKnown, notKnown, notKnown, notKnown); System.out.println( "SimpleEmail: " + "\n From: " + email.getSender() + "\n To: " + email.getRecipient() + "\n Subject: " + email.getSubject() + "\n Date: " + email.getDate().toString() + "\n Message: \n" + email.getContent() + "\n"); email.setSender( "Suresh Testsender"); email.setRecipient( "Suresh1 Receiver"); email.setSubject( "How are you today?"); email.setContent( "I just wrote an email class!"); System.out.println( "SimpleEmail: " + "\n From: " + email.getSender() + "\n To: " + email.getRecipient() + "\n Subject: " + email.getSubject() + "\n Date: " + email.getDate().toString() + "\n Message: \n" + email.getContent() + "\n"); } }
simple email compiles just fine but here are the errors i get when compiling simpleemailtest. can n e 1 helpCode:import java.util.*; class SimpleEmail { public String sender,recipient,subject,content; public Date dateOfEmail = new Date(); public SimpleEmail ( String sender, String recipient, String subject, String content) { this.sender = sender; this.recipient = recipient; this.subject = subject; this.content = content; } String getSender(){return sender; } String getRecipient(){return recipient;} String getSubject(){return subject;} String getContent(){return content;} Date getDate(){return dateOfEmail;} void setSender(String newSender){ sender=newSender; } void setRecipient(String newRecipient){ recipient=newRecipient; } void setSubject(String newSubject){ subject=newSubject; } void setContent(String NewContent){ content=NewContent; }}
Code:--------------------Configuration: JDK version 1.1.8 <Default>-------------------- C:\Program Files\Xinox Software\JCreator LE\MyProjects\SimpleEmailTest.java:12: '}' expected. String content; // text content of email ^ C:\Program Files\Xinox Software\JCreator LE\MyProjects\SimpleEmailTest.java:14: Statement expected. public static final String notKnown = "Unknown"; ^ C:\Program Files\Xinox Software\JCreator LE\MyProjects\SimpleEmailTest.java:16: Identifier expected. email = new SimpleEmail(notKnown, notKnown, notKnown, notKnown); ^ 3 errors Process completed.
[ArchAngel added CODE tags]


Reply With Quote


Bookmarks