Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gist showing basic use of integer variables
/*
* Copyright (c) 2014.
*/
package main.java.com.oopuniversity.basics.variables;
/**
* Created by OOPUniversity on 11/15/2014.
*/
public class Variables {
/**
*
* Outlines some very basic usage of integer and boolean variables in Java
*
*/
public static void main(String[] args) {
int one = 1;
one = one + 1;
//Multiplication:
one = one * 2;
//Division:
one = one / 2;
//Subtraction:
one = one - 1;
System.out.println("one = " + one);
int n = 5;
boolean nEquals5 = (5 == n);
System.out.println("Does n equal 5? " + nEquals5);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment