-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2021 Sem 1 Q1b - Approach + Naming of classes #383
Comments
The question is asking for a java file, so your code should be written as how you would normally! I don't think the public matters in this case as long as your class follows what the question is asking for and it works when you run your tests in (a). |
For me, I named the classes by their direct names (ie class A{...}, class B {..} and so on). I do understand where your concern stems from, given that we were taught to name our classes the same way as our files. However, for this case I felt like the filenames were more for marking convenience since they followed a certain format throughout the paper, hence I thought it did not make sense to name it "class oop-b". Nonetheless, I believe that is more of a coding style issue so both ways of naming should still be functional. What is the error statement you get from the line public class oop-b{? |
Summary
Java file naming convention + approach
Description
There was a previous thread on the same question but since the focus of my question is a bit different I created a new subpart.
Sorry if this question sounds a bit trivial, but I'm a bit confused with regards to how to approach this question as well as the naming of classes. From my understanding, in part b we need to create a class that has a property of an object (for example, class B has a property other of type B while class C has a property of type C etc.)
Not sure if I may have misinterpreted the question but if that is the case, then how do I go about naming my classes? The question told us to save our code in a file called oop-b.java, but doesn't this mean that my file should have a line public class oop-b { (which will result in compilation errors) ? Or is there something I am missing here...?
Also for some reason I have a feeling this question is also related to generics (?) but I'm not too sure..
Screenshots (if any):
The text was updated successfully, but these errors were encountered: