Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package uil;
- public class Lesson5 {
- public static void main(String[] args) {
- //Casting
- double d=29.78;
- int i=(int)d;
- int j=105;
- double douche=j;
- //The most precise
- int idiot=4;
- double dog=3;
- double ans=idiot/dog;
- System.out.println(ans);
- System.out.println(3+5.0/2+5*2-3);
- System.out.println(3.0+5/2+5*2-3);
- System.out.println((int)(3.0+4)/(1+4.0)*2-3);
- //Don't be fooled
- double dick=(double)5/4;//double only applies to 5
- System.out.println(dick);
- int jazz=5;
- int k=4;
- double duck=(double)(jazz/k);//jazz/k is done first, then cast as double
- System.out.println(duck);
- //Constants
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement