[問題]java新手 java.io 無法執行?

看板java作者 (SP_one)時間6年前 (2017/07/26 02:10), 編輯推噓0(006)
留言6則, 5人參與, 最新討論串1/2 (看更多)
我是在 Eclipse 編輯 使用 java.io 卻發生問題 直接複製網路上的教學也是無法執行? 以下是我所編譯的 package pratice; import java.io.*; public class prac_ch03 { public static void main(String args[])throws IOException { float height; float weight; System.out.println("Please input your height."); height = keyin.readLine(); System.out.println("Please input your weight."); weight = keyin.readLine(); System.out.println("Your BMI is :" + weight/(height*height)); } } 執行出現: Exception in thread "main" java.lang.Error: Unresolved compilation problems: keyin cannot be resolved keyin cannot be resolved at pratice.prac_ch03.main(prac_ch03.java:13) 請問是我忽略甚麼步驟以至於如此嗎? 在網路上尋找都找不到解答 麻煩各位! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.42.165.202 ※ 文章網址: https://www.ptt.cc/bbs/java/M.1501006236.A.767.html

07/26 02:26, , 1F
沒看到你宣告keyin呀....
07/26 02:26, 1F

07/26 09:13, , 2F
你在哪裡看到keyin的用法的?
07/26 09:13, 2F

07/26 10:15, , 3F
複製貼上前也先該稍微看懂一下再貼吧
07/26 10:15, 3F

07/26 10:15, , 4F
你這個是連基本JAVA觀念都沒有,先補足基礎再開始吧
07/26 10:15, 4F

07/27 01:42, , 5F
缺的keyin可能長這樣 http://i.imgur.com/g0Z6TeN.png
07/27 01:42, 5F

08/23 13:50, , 6F
Compiler給的錯誤訊息要會看啊...
08/23 13:50, 6F
文章代碼(AID): #1PTucSTd (java)
文章代碼(AID): #1PTucSTd (java)