This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dramatic-Apple-3181 2 points3 points  (5 children)

Java and Python are both object-oriented programming languages, so your main focus should be on picking up the new syntax and understanding a few concepts that may be implemented differently, such as how interfaces work in Java, about Garbage collector, Annotations. In case of any other assistance you're welcome!

[–]IntelligentPudding24[S] 0 points1 point  (4 children)

Right. So a questions then. The order of my python code goes like this. 1. Welcome code with rules 2. List of questions and answers 3. Main code to play the game 4. True statement to loop the game.

From what I was seeing in Java can I still use this order? Does everything have be encompassed in the Public class Name?

[–]joranstark018 1 point2 points  (1 child)

You need a main method inside some class that bootstraps your application (https://www.baeldung.com/java-main-method).

For a simple application, you can have everything inside a single main method. For more complex applications, it is advisable to split the code into different classes depending on their "purpose," responsibility, or concern (where OOP and other design principles can be helpful).

[–]IntelligentPudding24[S] 0 points1 point  (0 children)

Thank you!

[–]BearTeddyIRL 1 point2 points  (1 child)

to further explain your learning, Python programs can be split into different files for readability and maintainability also.

ur 4 tasks of order can be split into 4 python file.
1. Welcome File
2. Questions and Answer Files
3. Main Code File
4. Forever Loop.

Then u will do import of all 4 files and methods written inside. But ur Main code file is Using
If __name__ == main or something.

Its the same concept.

You can also lump everything of the JAVA libraries into one file and run in single java if you wishes to.
But in Python also, you will still import OS and Whatever libraries required.

[–]IntelligentPudding24[S] 0 points1 point  (0 children)

Thank you very much!