If -else statements, need help with understanding the main method and scope before the main method

can someone help me understand the main method? I see that calculateShipping is using a method outside of the method scope but still within the class scop. You can call other methods within the same class scope? Meaning before the main method all methods can call on each other? I am so confused, and I apologize if my explanation is confusing. :rofl:

You’re pretty close!
So, (pretty much) all methods within a class can call other methods within the same class. That way, you can have helper functions called within other functions:

public class main{
  public int helpFunc(){
    return 5;
 public int mainFunc(int a){
   int someVar = helpFunc();
   return a * someVar;

The main function is a little different to most other functions. It is the entry point when you run your code on a terminal. That means if you’re running a program using the terminal (like you do in Codecademy lessons), then you need a main function. This StackOverflow thread is definitely worth a read.

I hope that’s answered your questions!

1 Like

Thank you, yeah that makes sense.

1 Like