Good day. Recently, I began to learn Java from the book "Learning Java" and there was a problem with classes of more than two in one file.
Reached the objects, but somehow they do not fit. The book provides sample code, I enter it into NetBeans, but the program refuses to run. Yes, at the beginning of the book it was said not to use IDE, but still help, what can you, please, I am still very green.
Here is the error:
What just did not try to do, I can not fix it.
Here is the code:
class Movie { String title; String genre; int rating; void playIt() { } } public class MovieTestDrive { public static void main(String[] args){ Movie one = new Movie(); one.title = "Как Прогореть на Акциях"; one.genre = "Трагедия"; one.rating = -2; Movie two = new Movie(); two.title = "Потерянные в Офисе"; two.genre = "Комедия"; two.rating = 5; two.playIt(); Movie three = new Movie(); three.title = "Байт-Клуб"; three.genre = "Трагедия, но в целом веселая"; three.rating = 127; } }
publicin the class declaration? - Regent