Notices
Results 1 to 3 of 3

Thread: Coding problem in BlueJ

  1. #1 Coding problem in BlueJ 
    Forum Freshman
    Join Date
    Oct 2010
    Location
    Aberystwyth University
    Posts
    10
    Hi guys currently working on a Uni project and i'm getting a ";" expected error message when in the code I have clearly placed a semi colon where required, can anyone shed some light on the problem?


    /**
    * Write a description of class Port here.
    *
    * @author (Daniel Drave)
    * @version (Ocean Link v.1)

    *
    **/

    //***************************INSTANCE VARIABLES***************************************//
    public class Port
    {
    private String name;
    private boolean disabledaccess;
    private boolean hotel;
    private int portnumber;

    //************************************************** *********************************//


    /**
    * Constructor for objects of class Port
    */
    public Port()
    {
    // initialise instance variables
    name = "unknown";
    portnumber = 0;
    }

    public Port(String newname, int newnumber, boolean newinfo, boolean hotelinfo);
    {
    name=newname;
    portnumber=newnumber;
    disabledaccess=newinfo;
    hotel=hotelinfo;
    }
    // ** Now the variablkes have been initialised we need to get some information out of the program as shown below // **


    public String toString()
    {
    Stringret= "Port information:" "\n ""Port:"+name+"\n" "PortNo.:"+portnumber+"\n" "Disabled access:"+disabledaccess+ "\n" "Hotel:"+hotel+ "\n";

    return ret; ##SAYING IT'S AROUND HERE IT'S MISSING
    }


    }


    Keep it real!
    Reply With Quote  
     

  2.  
     

  3. #2  
    New Member
    Join Date
    Nov 2010
    Posts
    1
    output...


    __________________________________________

    http://www.industrialautomationtraining.com/
    http://www.plcscadatraining.net
    http://www.dcstraining.net/
    http://www.tiipa.com/
    http://www.accordsoft.in/


    Reply With Quote  
     

  4. #3  
    Forum Freshman Aero's Avatar
    Join Date
    Nov 2008
    Posts
    34
    If you still wouldn't have found this: try adding some '+' when declaring your String ret.

    Code:
    String ret = "a" + "b" //correct
    String ret = "a"   "b" //not correct
    Also notice there has to be a space between String and ret.
    Reply With Quote  
     

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