So, if you have ever looked on my page you might have found that I'm a Grade 10 student that's just started his computer science course in high school. Yaay! :)
The language that we are learning is Java, something which in my opinion, is very different from Python (at least so far). However, there's one thing that I have noticed when starting a Java program. Sorry if the syntax is off or wrong.
public static void main(String [] args){
String school = "A beautiful school";
System.out.print(school);
}
Is this equivalent to Python's:
if __name__ == "__main__":
school = "A beautiful school"
print(school)
I've asked my teacher about this but didn't seem to get an answer that I completely understand. I also took a look at this question, but it seemed as if it only answered the different keywords public
, static
, void
, (which I only slightly understand as of now).
So does public static void main
act the same as if __name__ == "__main__"
? If not, what's the difference between the two? Thanks in advance!