亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

編譯錯誤,請指教

編譯錯誤,請指教

昵稱什么DE 2017-12-14 08:59:15
import java.util.*;class Z implements Comparable{??? int age;?? ?public Z(int age){?? ??? ?this.age=age;?? ?}?? ?//?? ?public boolean equals(Object obj){?? ??? ?return true;?? ?}?? ?//?? ?public int compareTo(Object obj){?? ??? ?return 1;?? ?}?? ?public class TressSetTest2{?? ?? //下面代碼在編譯時出現?? “錯誤: 內部類Z.TressSetTest2中的靜態聲明非法,???????????????????????????????????????????????? public static void main(String[] args){???????????????????????????????????????????????? public static void main(String[] args){”????? 的錯誤,當我把“static”刪除時,又出現“錯誤: 找不到或無法加載主類 TreeSetTest2”? ? ? ? public static void main(String[] args){?? ?? ??? ??? ?TreeSet set=new TreeSet();?? ??? ??? ?Z z1=new Z(6);?? ??? ??? ?set.add(z1);?? ??? ??? ?//?? ??? ??? ?System.out.println(set.add(z1));?? ??? ??? ?//?? ??? ??? ?System.out.println(set);?? ??? ??? ?//?? ??? ??? ?((Z)(set.first())).age=9;?? ??? ??? ?//?? ??? ??? ?System.out.println(((Z)(set.last())).age);?? ??? ?}?? ?}}
查看完整描述

3 回答

?
果果愛吃蘋果

TA貢獻50條經驗 獲得超20個贊

代碼未做任何改動,就是復制你的代碼,要不你仔細檢查一下語法?或者用一下開發工具

http://img1.sycdn.imooc.com//5a31d7e80001073706420661.jpg

查看完整回答
反對 回復 2017-12-14
  • 3 回答
  • 0 關注
  • 1711 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號