Aug 7, 2024
.java
extension..class
extension.Configure JREs
and add the latest JDK.main
method (public static void main(String[] args)
).System.out.println
to print to the console.print
and println
:
println
adds a new line after printing.print
does not add a new line.// This is a comment
/* This is a multi-line comment */
Scanner
class to accept user input.import java.util.Scanner;
nextLine
, nextInt
, nextDouble
).+
, -
, *
, /
, %
(modulus).++
and decrement --
operators.(double)
before the expression).JOptionPane
class for simple GUIs.JOptionPane
: import javax.swing.JOptionPane;
JOptionPane.showInputDialog
.JOptionPane.showMessageDialog
.Math.max
, Math.min
, Math.abs
, Math.sqrt
, Math.round
, Math.ceil
, Math.floor
.Math.sqrt
to compute the square root.Random
class to generate random values.Random
: import java.util.Random;