#Java class priority

7 messages · Page 1 of 1 (latest)

paper kraken
#

Disclaimer: I know that what I am trying to do is bad design practice, but my professor is very unflexible on the way autograder handles assignments. I have a class, "Route", that must be used in my code. The sample handout has class "weightedEdge" as a second class in file "graph.java" that functions almost identically to route, while the route.java class exists in a separate file. If I want to use weightedEdge with my own additions instead of using the unchangable Route.java provided, can I rename weightedEdge to Route? Will java prioritize Route.java's route class or the Route class within graph.java?

inland otterBOT
#

This post has been reserved for your question.

Hey @paper kraken! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

nimble slate
#

Java uses systems where it's either impossible, or undefined by theses systems themselves, to have files of the same names, which would be what it takes to rename your classes to have the same name.
So either it's not even possible what you're saying, or it cannot be known what will be prioritized and that's not in Java's hands.

paper kraken
#

this is how the class files were compiled, if that helps

#

I resolved the issue with my professor, but still curious as to what the answer would be. Worked without any issue when testing like this, but still interesting

inland otterBOT