Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Navin Gada   on May 06 In Java Category.

  
Question Answered By: Eddie Austin   on May 06

The problem is in ur Elevator Constructor
Here is the corrected code

import java.util.*;

public class  Elevator
{
private LinkedList upList;
public Elevator()
{
upList = new LinkedList();
}

public void  insertUp (int floor)
{
Integer theFloor;
theFloor = new Integer(floor);
//System.out.println (theFloor);
Integer anotherFloor;
anotherFloor = new Integer(0);
int firstElement;
upList.add((Integer)theFloor);
anotherFloor = (Integer)upList.get(0);
firstElement = anotherFloor.intValue();
}

public int  getFirstFloor()
{
Integer ObjectFirstFloor =
(Integer)upList.get(0);
int firstFloor = ObjectFirstFloor.intValue();
return firstFloor;
}

Share: