Skip to content

Instantly share code, notes, and snippets.

@OOPUniversity
Created November 9, 2015 13:55
Show Gist options
  • Save OOPUniversity/d715b7b1f739110f8e55 to your computer and use it in GitHub Desktop.
Save OOPUniversity/d715b7b1f739110f8e55 to your computer and use it in GitHub Desktop.
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