- println method prints a line of text
- The System class and its out stream are used to access the println method
{
System.out.println(“Hello World!”);
}
java
There are 3 posts tagged java (this is page 1 of 1).
Hello world! Java
public class ExampleProgram {
public static void main(String[ ] args) {
System.out.println(“Hello World”);
}
}
Java arithmetic operators
- Arithmetic operators are used in mathematical expressions in the same way that they are used in algebraic equations.
+ addition
– subtraction
* multiplication
/ division
% modulo
+ operator
- The + operator adds together two values, such as two constants, a constant and a variable, or a variable and a variable.
int sum1 = 50 + 10;
int sum2 = sum1 + 66;
int sum3 = sum2 + sum2;
– subtraction
int sum1 = 1000 – 10;
int sum2 = sum1 – 5;
int sum3 = sum1 – sum2;