Variables for storing intermediate values - Java Language Basics

Java examples for Language Basics:Variable

Description

Variables for storing intermediate values

Demo Code

public class Main{
    public static void main(String[] args) {
        int credit;
        int debit;

        credit = 100 + 150;/* w w  w  .j  av  a  2  s .  c  o  m*/
        System.out.print("Total credit (in US dollars):\t");
        System.out.println(credit);

        debit = 50 + 25 + 100;
        System.out.print("Total debit (in US dollars):\t");
        System.out.println(debit);

        System.out.print("Balance:");
        System.out.println(credit - debit);
    }
}

Related Tutorials