Values in Minitab

Java has various value types including strings, integers, floats, booleans, etc. Here are a few basic examples.

public class Values {
    public static void main(String[] args) {
        // Strings, which can be added together with +.
        System.out.println("java" + "lang");

        // Integers and floats.
        System.out.println("1+1 = " + (1 + 1));
        System.out.println("7.0/3.0 = " + (7.0 / 3.0));

        // Booleans, with boolean operators as you'd expect.
        System.out.println(true && false);
        System.out.println(true || false);
        System.out.println(!true);
    }
}

To run the program, compile it and then use java to execute:

$ javac Values.java
$ java Values
javalang
1+1 = 2
7.0/3.0 = 2.3333333333333335
false
true
false

In this Java example, we’ve used the System.out.println() method to print values to the console, which is equivalent to Go’s fmt.Println(). Java’s string concatenation, arithmetic operations, and boolean logic work similarly to Go’s.

Note that in Java, we need to wrap the main code in a class, and the entry point is the main method with a specific signature. Also, Java uses // for single-line comments, similar to Go.