Skip to main content Link Search Menu Expand Document (external link)

Tutorial 1 - Introducing Java through the lens of UML and OOP


Slides

Can be found here.

Resources

  1. An Introduction to Abstraction (link)
  2. Documentation on OOPs in Java (link)
  3. JVM, JDK, JRE (link)
  4. Some more on the main function (link)

Aside

  1. A paper on UML->Java (link)
  2. On the evolving nature of Java Interfaces (link)

Questions from the Tutorial

1. How many main function can exist within an app?

There can only be one main method that serves as the entry point for program execution which must be defined using:

public static void main(String[] args)
  • If a Java file contains multiple classes, each class can have its own main method, but only one of them can be executed as the program’s starting point.
  • If there are multiple main methods with the correct signature in the same class (as in multiple having String[] args), it will result in a compilation error.
  • However, Java allows for method overloading, meaning you can define multiple methods named main in the same class or different classes, provided they have different parameter lists soft of like:
public static void main(int i)
public static void main(String s)

These overloaded methods can exist alongside the standard main method, but only the original public static void main(String[] args) will be recognized by the JVM as the entry point.


Copyright © 2025 Karthik Vaidhyanathan. Distributed by an MIT license.