Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2007, 08:12 PM
Senior Member
 
Join Date: Jun 2007
Posts: 114
Albert is on a distinguished road
I am not able to print Address
I need help with this program. I am not able to print Address through the main method

Code:
public class Employee { private String id; private String Address; public Employee(String id,String fname,String lname,String city,String state,String zip) { this.id = id; Address address = new Address(fname,lname,city,state,zip); System.out.printf(" %s\n%s\n ",id,address.toString()); } public String toString() { return String.format("%s\n %s:\n ",id,Address); } public static void main (String args[]) { Employee e= new Employee("1000","Vijaya","Nimma","Detroit","MI","48334"); System.out.printf(e.toString()); }
Thanks
Albert
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-13-2007, 04:37 PM
Member
 
Join Date: Jul 2007
Posts: 44
susan is on a distinguished road
First of all, where is the Address class. The following line indicates that you have a class of type Address.
Code:
Address address = new Address(fname,lname,city,state,zip);
Second, you have declared a String and you named it Address, but you never assigned any value to it.
Code:
private String Address;
Actually, I don't think your class can be compiled, unless you have some other code that you have not posted here.

Solution: You must either declare a class of type Address that would handle the processing of Employee's addresses and, you must make sure that you stick to Sun Java Conventions so that other developers can read your code.
For example, a variable should not start with a capital letter etc.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP – getting IP address Java Tip Java Tips 0 01-29-2008 10:05 AM
Print XML tag DonCash XML 2 08-07-2007 07:02 PM
doubt about PRINT API valery New To Java 1 08-06-2007 10:51 PM
Print A Pdf Jack Advanced Java 2 07-02-2007 06:40 AM
print .doc in java Alan Advanced Java 1 05-17-2007 05:05 AM


All times are GMT +3. The time now is 04:17 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org