“So wechseln Sie doppelt in Java in Int” Code-Antworten

Doppelte doppelt in in java konvertieren

int intValue = (int)doubleValue;
Perfect Peccary

So wechseln Sie doppelt in Java in Int

class Scratch{
    public static void main(String[] args){
        double decimal = 5.7;
        System.out.println( (int) decimal );	//casting
        System.out.println( Math.round(decimal * 10) / (double) 10);	//Math.round()
        System.out.println( decimal % 1);	// modulus
        System.out.println( Integer.parseInt( String.valueOf(decimal).substring(0, String.valueOf(decimal).indexOf(".")))); // .substring()
    }
}
Nitbit25

Ähnliche Antworten wie “So wechseln Sie doppelt in Java in Int”

Fragen ähnlich wie “So wechseln Sie doppelt in Java in Int”

Weitere verwandte Antworten zu “So wechseln Sie doppelt in Java in Int” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen