// Java Code to implement// longValue() method of Float classclassGFG{// Driver methodpublicstaticvoidmain(String[] args){// creating a Float objectFloat d =newFloat(1022);// longValue() method of Float class// typecast the valuelong output = d.longValue();// printing the outputSystem.out.println(output);}}
输出:
1022
方案二:
// Java Code to implement// longValue() method of Float classclassGFG{// Driver methodpublicstaticvoidmain(String[] args){// creating a Float objectFloat d =newFloat(-1023.23);// longValue() method of Float class// typecast the valuelong output = d.longValue();// printing the outputSystem.out.println(output);}}