Advertisement
Guest User

Yooneees

a guest
Dec 1st, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package uil;
  2.  
  3. public class Lesson5 {
  4.  
  5.     public static void main(String[] args) {
  6.         //Casting
  7.             double d=29.78;
  8.             int i=(int)d;
  9.             int j=105;
  10.             double douche=j;
  11.         //The most precise
  12.             int idiot=4;
  13.             double dog=3;
  14.             double ans=idiot/dog;
  15.             System.out.println(ans);
  16.             System.out.println(3+5.0/2+5*2-3);
  17.             System.out.println(3.0+5/2+5*2-3);
  18.             System.out.println((int)(3.0+4)/(1+4.0)*2-3);
  19.         //Don't be fooled  
  20.             double dick=(double)5/4;//double only applies to 5
  21.             System.out.println(dick);
  22.             int jazz=5;
  23.             int k=4;
  24.             double duck=(double)(jazz/k);//jazz/k is done first, then cast as double
  25.             System.out.println(duck);
  26.         //Constants
  27.            
  28.            
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement