Results 1 to 6 of 6
  1. #1
    tike is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Question passing date into parameter

    Hello all,

    Im new to java and have a question:

    passing date into parameter-untitled-1.jpg

    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:

    Java 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;
    	}
    
    ....

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,611
    Rep Power
    25

    Default 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?

  3. #3
    tike is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default 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.

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,611
    Rep Power
    25

    Default Re: passing date into parameter

    Sorry, I have no experience with BlueJ.

  5. #5
    tike is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default 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.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default 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.

Similar Threads

  1. Passing final parameter from a class
    By ianyappy in forum New To Java
    Replies: 8
    Last Post: 12-02-2010, 08:06 PM
  2. passing parameter to a thread
    By adammyth in forum Threads and Synchronization
    Replies: 1
    Last Post: 01-02-2010, 08:58 PM
  3. passing a parameter
    By aarthi2learn in forum AWT / Swing
    Replies: 4
    Last Post: 12-22-2008, 06:46 AM
  4. Passing short value as parameter
    By javanewbie83 in forum New To Java
    Replies: 16
    Last Post: 07-16-2008, 06:27 AM
  5. passing an enum type as a parameter ??!
    By SCS17 in forum New To Java
    Replies: 11
    Last Post: 07-13-2008, 02:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •