brooksn
Mar 11, 2003, 12:20 AM
Here is my code: I get the error:
Array required, but PRmList found. Any help would be GREATLY appreciated. Thanks!
Public class PRm
{
Private String PRm;
Private String movieTitle;
Private String movieRating;
Private int seats;
Public PRm(String prm, String movie, String rating, int sts)
{
PRm=prm;
MovieTitle=movie;
MovieRating=rating;
Seats=sts;
}
Public String getmovieTitle()
{
Return movieTitle;
}
}
Public class PRmList
{
PRm[] pRmList;
Public void createList()
{
PRmList = new PRm[5];
PRmList[0]= new PRm("PR1", "Fast and the Furious", "R", 90);
PRmList[1]= new PRm("PR2", "Usual Suspects", "R", 70);
PRmList[2]= new PRm("PR3", "Spy Game", "R", 80);
PRmList[3]= new PRm("PR4", "Die Hard 3", "R", 60);
PRmList[4]= new PRm("PR5", "Lord of the Rings", "R", 100);
}
}
Import java.io.*;
Public class Test
{
Public static void main(String[] args)
{
PRmList lis = new PRmList();
Lis.createList();
Lis[0].getmovieTitle(); // Error is here
}
}
Array required, but PRmList found. Any help would be GREATLY appreciated. Thanks!
Public class PRm
{
Private String PRm;
Private String movieTitle;
Private String movieRating;
Private int seats;
Public PRm(String prm, String movie, String rating, int sts)
{
PRm=prm;
MovieTitle=movie;
MovieRating=rating;
Seats=sts;
}
Public String getmovieTitle()
{
Return movieTitle;
}
}
Public class PRmList
{
PRm[] pRmList;
Public void createList()
{
PRmList = new PRm[5];
PRmList[0]= new PRm("PR1", "Fast and the Furious", "R", 90);
PRmList[1]= new PRm("PR2", "Usual Suspects", "R", 70);
PRmList[2]= new PRm("PR3", "Spy Game", "R", 80);
PRmList[3]= new PRm("PR4", "Die Hard 3", "R", 60);
PRmList[4]= new PRm("PR5", "Lord of the Rings", "R", 100);
}
}
Import java.io.*;
Public class Test
{
Public static void main(String[] args)
{
PRmList lis = new PRmList();
Lis.createList();
Lis[0].getmovieTitle(); // Error is here
}
}