1 Attachment(s)
passing date into parameter
Hello all,
Im new to java and have a question:
Attachment 2155
I cant figuere out why i get this error: <identifier> expected
I think it has something to do with the last Date param.
Hope someone can help me out here.
p.s. here is a piece of my code:
Code:
public class Persoon
{
/*
* Fields
*/
private String achternaam;
private String voornaam;
private char geslacht;
private Date geboortedatum;
/*
* Constructor
* Velden van Persoon initialiseren
*/
public Persoon(String persoonAchternaam, String persoonVoornaam, char persoonGeslacht, Date persoonGeboortedatum)
{
achternaam = persoonAchternaam;
voornaam = persoonVoornaam;
geslacht = persoonGeslacht;
geboortedatum = persoonGeboortedatum;
}
....
Re: passing date into parameter
That error message looks like one that comes from a compiler.
How are you compiling your program?
How do you execute the program after it compiles with no errors?
Re: passing date into parameter
Just removed all the Date field(s) from the code.
The error does not seem to appear any more.
Could it be something to do with the way i am currently inserting the Date in the last param field? "5,1,1996" (also tried this: "1996,1,5" and "(1996,1,5)" ) except the quotes ofcourse.
Re: passing date into parameter
Sorry, I have no experience with BlueJ.
Re: passing date into parameter
No problem,
I'm glad i figured out what caused the error.
If i find a solution i will get back here.
Cheers.
Re: passing date into parameter
Date is an object, so unlike Strings you need to do new Date(<some long value here representing the date in millis>).
Of course it's possible this won't work in BlueJ...not used it.