Created
September 24, 2018 11:40
-
-
Save KylePiira/61c521ba513cc24c0145f8560344285f to your computer and use it in GitHub Desktop.
Simple Java program to test integer division.
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
public class IntDivision { | |
public static void main(String[] args) { | |
System.out.println("int / int = int"); | |
System.out.println("1 / 3 = " + 1 / 3); | |
System.out.println("int / double = double"); | |
System.out.println("1 / 3. = " + 1 / 3.); | |
System.out.println("Another Example:"); | |
Integer v1 = 1 / 1; | |
Double v2 = 1 / 1.; | |
System.out.println("1 / 1 = " + v1); | |
System.out.println("1 / 1. = " + v2); | |
System.out.println(v1.getClass()); | |
System.out.println(v2.getClass()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment