Class errors


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Class errors

  1. #1
    Jenny Smith Guest

    Class errors


    I been trying to develop a class for the last few days and an error appears
    whenever i try to compile the test file. I'm not sure what i have done wrong,
    can you take a look at my code to see where i might have gone wrong. I am
    not a genious at this so i would be very grateful if you could help me before
    this Friday. Here's my code

    This is the test file.....


    public class SimpleSeatTest {
    public static void main( String[] args ) {
    SimpleSeat seat; // Seat object to test.
    int row; // Row number of seat.
    int pos; // Position in row of seat.
    int status; // Seat status.

    seat = new SimpleSeat(0,0);// Create a SimpleSeat object.

    row = seat.getRow();
    pos = seat.getPosition();
    status = seat.getStatus();
    System.out.println( "SimpleSeat: row=" + row +
    " position=" + pos + " status=" + status );

    seat.setStatus( 1 );
    System.out.println( "SimpleSeat status changed:" );

    status = seat.getStatus();
    System.out.println( "Seat status=" + status );
    }
    }

    and this is the class i developed....

    class SimpleSeat {
    private int[] row; //initialsing instance variables
    private int[] pos;
    private int status

    public SimpleSeat (int x, int y) { //construtor
    row = x;
    pos = y;
    }

    public int getRow() { //methods
    return row;
    }

    public int getPosition() {
    return pos;
    }

    public int getStatus() {
    return status;
    }

    public void setStatus(int newStatus) {
    status = newStatus;
    }
    }

    Yours sincerely
    Jenny

  2. #2
    Rishi Sahni Guest

    Re: Class errors


    class SimpleSeat {
    private int row; //initialsing instance variables
    private int pos;
    private int status;

    public SimpleSeat (int x, int y) { //construtor
    row = x;
    pos = y;
    }

    public int getRow() { //methods
    return row;
    }

    public int getPosition() {
    return pos;
    }

    public int getStatus() {
    return status;
    }

    public void setStatus(int newStatus) {
    status = newStatus;
    }
    }

    modify ur class as above



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center