作者warewolf (一個人)
看板java
標題[問題] 如何使用別人的class檔
時間Wed Mar 24 13:26:50 2010
老師出了一個作業
要用他寫的class檔
我們看不到code
請問要怎麼include進去自己的class檔呢
我查了好久一直不知道怎麼辦
請問有人可以幫忙嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.4.198
1F:→ hnint0926:看不到檔案也可以include = =|||你應該多看點書ㄅ!! 03/24 13:36
2F:→ warewolf:就是include不進去阿....... 03/24 13:38
3F:→ hnint0926:class檔名 n = new clss檔名(); 03/24 13:38
4F:→ warewolf:我是這樣打沒錯...可是INCLUDE不進來... 03/24 13:39
5F:→ hnint0926:有放在同一個資料夾裡面? 03/24 13:40
6F:→ warewolf:對... 03/24 13:40
7F:→ hnint0926:你沒放程式碼出來哪知道錯在哪裡 03/24 13:41
public class 123132 {
public static void main (String[] args){
123 n =new 123();
}
}
就只有這樣而已 class檔放在src裡面
※ 編輯: warewolf 來自: 140.112.4.198 (03/24 13:43)
8F:→ terrybob:- -說真的,我當初也不會。還看了老半天的java網頁… 03/24 13:48
9F:→ hnint0926:變數宣告可以用數字??而且老師是用數字嗎? 03/24 13:49
10F:→ warewolf:123是英文 我只是把他改掉而已... 03/24 13:50
11F:→ hnint0926:那老師的檔名哩!!!錯誤訊息勒!!!! 03/24 13:52
上面的那些數字都是英文 錯誤訊息是 XXX cannot be resolved to a type
變數第一個不能打數字這我知道
※ 編輯: warewolf 來自: 140.112.4.198 (03/24 13:53)
※ 編輯: warewolf 來自: 140.112.4.198 (03/24 13:54)
12F:→ hnint0926:XXX是變數? 03/24 13:57
13F:→ warewolf:XXX就是 我要引進的CLASS名稱 03/24 13:58
14F:→ hnint0926:不過你看不到程式碼那老師有給妳class檔案? 03/24 14:00
15F:→ warewolf:有給CLASS 03/24 14:02
Could not open the editor: The Class File Viewer cannot handle the given
input ('org.eclipse.ui.ide.FileStoreEditorInput').
※ 編輯: warewolf 來自: 140.112.4.198 (03/24 14:03)
16F:→ lluck:感覺是classpath沒有設到src的目錄, 但話說放在src本來 03/24 14:09
17F:→ hnint0926:用package方法試看看ㄅ 03/24 14:09
18F:→ lluck:就有點怪怪的@@a 03/24 14:10
19F:推 SHANGOYANYI:沒import吧... 03/24 21:28