Java has various value types including strings, integers, floats, booleans, etc. Here are a few basic examples.
To run the program, compile it and then use java to execute:
In this example, we’ve demonstrated:
String concatenation using the + operator.
Basic arithmetic operations with integers and floating-point numbers.
Boolean operations including AND (&&), OR (||), and NOT (!).
Note that in Java, we use System.out.println() for console output instead of fmt.Println(). Also, Java requires all code to be within a class, so we’ve wrapped our main method in a Values class.