# 056 TestCast.java /* * 此範例為測為型別晉升與型別轉換 */ public class TestCast { public static void main(String[] args) { int i = 1; double d = 11.1; double sum1 = i + d; int sum2 = (int)(i + d);//int sum2 = (int)需使用強制轉換(i + d); System.out.println(sum1); System.out.println(sum2); } }
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up