“Casting in Java” Code-Antworten

Java -Typ Casting

public class Main {
  public static void main(String[] args) {
    int myInt = 9;
    double myDouble = myInt; // Automatic casting: int to double

    System.out.println(myInt);      // Outputs 9
    System.out.println(myDouble);   // Outputs 9.0
  }
}
The Cat Coder

Java -Typ Casting

Lowest to highest primitive data types: Byte-->Short-->Int-->Long-->Float-->Double
Sandeep Choudhary

= Operator Casting in Java

    int x = 0;
    x += 1.1;    // just fine; hidden cast, x == 1 after assignment
    x = x + 1.1; // won't compile! 'cannot convert from double to int'
Selfish Seahorse

Casting in Java

Byte-->short-->char-->Int-->long-->float-->double
Blue-eyed Barracuda

Ähnliche Antworten wie “Casting in Java”

Fragen ähnlich wie “Casting in Java”

Weitere verwandte Antworten zu “Casting in Java” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen