-
Are my comments correct?
Below I am going to post some code, I just want a confirmation from someone as to whether my comments in the code are correct,
so that I know if I am understanding inner class correctly. Items in Magenta are what I want my classes to do.
Code:
/**
* MusicCollection class = outer class for: Artist, and Recording classes
* @author twiggy62
*/
[COLOR="Blue"]public class[/COLOR] MusicCollection {
[COLOR="Magenta"]// must have an array of Artist objects and an array of Recording objects[/COLOR]
/**
* Artist class = member inner class of MusicCollection class
*/
[COLOR="blue"]private class[/COLOR] Artist {
}
/**
* Recording class = member inner class of MusicCollection class
* and, outer class for: Track class
*/
[COLOR="blue"]private class[/COLOR] Recording {
[COLOR="Magenta"]// must have a single Artist object and an array of Track objects[/COLOR]
/**
* Track class = inner class of Recording class
*/
[COLOR="blue"]private class[/COLOR] Track {
[COLOR="Magenta"]// Track objects represent a single piece of music within a Recording object[/COLOR]
}
}
/**
* Test method
* @param args the command line arguments
*/
[COLOR="blue"]public static void[/COLOR] main(String[] args) {
[COLOR="Magenta"]// test the creation of all these objects[/COLOR]
}
}
-
Just a nit-pick: mostly your (magenta) comments are about what you want the classes to be rather than what they should do. Ie implementation rather than behaviour.
Anyway... You have declared the classes (and that looks OK), but you haven't actually created the arrays.
Also, why are these things inner classes? If that's some sort of assignment condition then fair enough. But it seems to me that later you might also want to have ConcertProgramCollection class which would refer to instance of Artist. But you have made Artist a private inner class so there's no way both collections could "speak the same language".
-
Thank you for looking at my code.
Yeah, the magenta code will be filled in by me later, I was just questioning the
structure of my classes.
You were right in saying: "Just a nit-pick: mostly your (magenta) comments
are about what you want the classes to be rather than what they should
do. Ie implementation rather than behavior."
As far as them being inner classes, and being private, is because I do not want
other classes to be able to access them, the only class I want to have access
to them would be the MusicCollection class.