Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lessons;
- public class IntAndFloatPointDiv
- {
- public static void main(String[] args)
- {
- double n1;
- n1 = 5/2;
- System.out.println(n1);
- //when two numbers are integer numbers(without decimal)
- //you will get int result
- double n2;
- n2 = 5.0/2;
- System.out.println(n2);
- // when using a float you will always get a floating point number
- //will always put it in highest datatype out of the ones used
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement