[course04] 01 Build-in Subrouting and Functions

static

static members of the class.

public static void main(String[] args){
...
}

When a class contains a static variable or subroutine, the name of the class is part of the full name of the variable or subroutine.

Exit

System.exit(0);

Calling System.exit will terminate the program and shut down the Java Virtual Machine. You could use it if you had some reason to terminate the program before the end of the main routine.

Math

Dev docs Math

import math method:

  • Math.abs(x)

  • Math.sin(x), Math.cos(x), and Math.tan(x)

  • Math.asin(x), Math.acos(x), and Math.atan(x)

  • Math.exp(x), Math.log(x)

  • Math.pow(x,y)

  • Math.floor(x), Math.ceil(x), Math.round(x)

  • Math.random

  • Random object

  • Random methods:

    • nextInt()

    • nextFloat()

    • nextLong()

    • nextDouble()

    • nextInt()

use the round( ) methods in java.lang.Math

Time functions

System.currentTimeMillis()

Last updated

Was this helpful?