View Single Post
Old 09-23-2004, 09:55 AM   #7 (permalink)
feelgood
Free Mars!
 
feelgood's Avatar
 
Location: I dunno, there's white people around me saying "eh" all the time
Couple problems:

You're still using varaibles before they're even created. You need to move the date formatting and strings block of codes before displaying the user name and date.

What is String title = datetoday;? datetoday doesn't even exist yet! And it's not a string.

In the line date = myDateFormat.format( today ); The variable today and myDateFormat doesn't even exist yet.

There's a total of 3 variables that are being used that hasn't been intialized yet. And 1 variable that isn't even being used at all

That's from looking at your recent coding.

From your first post:

String date;
Date today;
today = new Date ( );
date = new SimpleDateFormat ( "MM/dd/yy*)

This block of code is better than what you have now. The only problem with it is that the date = new SimpleDateFormat ( "MM/dd/yy*) line is in error. date is already a String type, not a SimpleDateFormat. So, either you change the line String date; to SimpleDateFormat date; or rename the variable date in the line date = new SimpleDateFormat ( "MM/dd/yy*) to something else.

Quote:
another pointer, you may be able to just add the date like you currently have, but check to see if there is a date.toString() function. More than likely there is. Since it is an object, it doesnt necessarily mean it will give you a pretty string when appending it to a String.
On the contray, if you use System.out.println(date); it's the same as System.out.println(date.toString());

Read the SimpleDateFormat API. And to get even better marks, I suggest that you should use proper naming conviction
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war

Last edited by feelgood; 09-23-2004 at 10:02 AM..
feelgood is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62