Can I use Parameters of a method invoked within an array in Java -


this in main() method:

movie[] list = new movie[6];  list[0] = new animated(.25, 700.000, "mulan", "barry cook", 1998, 15.000); list[1] = new animated(.23, 45.000, "tmnt", "steve barron", 1990, 12.000); list[2] = new documentary(12, 7.000, "nixon", "oliver stone", 1995, 50.000); list[3] = new documentary(10, 4.500, "jfk", "oliver stone", 1991, 35.000); list[4] = new drama(3.500, 8.25, "belly", "hype williams", 1998, 20.000); list[5] = new drama(4.500, 9.00, "42", "brian helgeland", 2013, 16.000);  system.out.print(menu()); system.out.print("select , menu option 1-5: "); choice = input.nextint(); {     switch(choice)     {         case 1: movielist(list);         break; 

and i'm calling movielist(list) method exists within class outside main:

public static void movielist(movie[] a) {     system.out.printf("\n\n%-10s %-10s %-10s %-10s %-10s", "title", "year",     "revenue", "profit", "category");     system.out.printf("\n\n%-10s", movie[0].gettitle()); } 

this method calling in case 1, how have been trying use 1 parameter , "cannot find symbol" error pointer @ movie. have been searching , beginning think cannot access value way.

the name of movie[] parameter in movielist method a, try using a[0].gettitle() instead of movie[0].gettitle(). parameters in method accessed it's name, not it's type.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -