Created
November 9, 2015 13:55
-
-
Save OOPUniversity/d715b7b1f739110f8e55 to your computer and use it in GitHub Desktop.
Gist showing basic use of integer variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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