CSC300: Fully qualified class names [4/12] Previous pageContentsNext page

PythonJava
01
02
03
04
05
def main():
    print("Hello")

if __name__ == "__main__":
    main()
01
02
03
04
05
06
package algs11;
public class Hello {
  public static void main (java.lang.String[] args) {
    stdlib.StdOut.println ("Hello");
  }
}

As an alternative to using import, you can also use a class's fully qualified name, which includes the package explicitly.

Fully qualified names make code rather verbose, so usually people prefer to use import.

Previous pageContentsNext page