User Tools

Site Tools


java:codes:variables

Variables

This is a simple “Variable” example.

VariableExample.java
public class VariableExample {
 
     public static void main(String[] args) {
 
          double a;
          double b;
          double plus;
          double minus;
          double division;
          double multiplication;
 
          a = 3;
          b = 4;
 
          plus = a + b;
          minus = a - b;
          division = a / b;
          multiplication = a * b;
 
          System.out.println("a + b = " + plus);
          System.out.println("a - b = " + minus);
          System.out.println("a / b = " + division);
          System.out.println("a * b = " + multiplication);
     }
}



java/codes/variables.txt · Last modified: 2017/10/02 15:13 by lunetikk