輸出結果:
思考過程:
我的想法是先想要input(輸入)什麼
接著在紙上寫下12345
再去思考output(輸出)什麼
在12345的下方寫下54321
方法1-我當時有設定CLASSPATH,所以把CLASSPATH刪掉就解決這個問題 😊
現在程式可以正常執行了^_^b
方法2-後來又再發生一次,找到一個方法讓程式可以執行。
輸入 【java -cp . [檔案名稱]】
就可以成功解決
<排版順序>
題目->答案->個人解題方式->重點整理
程式碼:
package college;
import java.util.Scanner;
public class OddEven {
【題目】
1.
Which two array initialization statements are valid?
在Java中,常常會需要將型態轉換,String轉int的方法如下。
int a=Integer.parseInt(“2”);
2.
int b=Integer.valueOf(“3”);
原因:
現有一家3C商店,要求你設計一個簡易收銀找零應用程式需求為:
使用MVC來做出一個簡單作品