You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Test {
public static void main(String args[]){
double d = 100.04;
long l = (long)d;
int i = (int)l;
System.out.println("Double Value = " + d);
System.out.println("Long Value = " + l);
System.out.println("Integer Value = " + i);
}
}
Output
Double Value = 100.04
Long Value = 100
Integer Value = 100
Comment ( I think this program of your question is Wrong )
Find the output of following program
class Demo {
public int myMethod(int num1, int num2){
System.out.println("First myMethod of class demoo");
return num1 + num2;
}
public int mySecondMethod(int var1, int var2){
System.out.println("Second myMethod of class demoo");
return var1 - var2;
}
}
public class Sample4 {
public static void main(String args[]){
Demo obj1 = new Demo();
obj1.myMethod(10, 10);
obj1.mySecondMethod(20, 12);
}
}
Output
First myMethod of class demoo
Second myMethod of class demoo