第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

Java編程思想組合語法

Java編程思想組合語法

道可道非常道 2016-09-28 19:59:42
package TestPackage;class WaterSource {private String s;WaterSource() {System.out.println("WaterSource()");s = "Constructed";}public String toString() {return s;}public class SprinklerSystem {private String value1,value2,value3,value4;private WaterSource source = new WaterSource();private int i ;private float f;public String toString() {return"value1 = " + value1 + " " + "value2 = " + value2 + " " + "value3 = " + value3 + " " +"value4 = " + value4 + "\n" + "i = " + i + " " + "f = " + f + " " +"Source = " + source;}}public static void main(String[] args) {SprinklerSystem sprinklers = new SprinklerSystem();System.out.println(sprinklers);}}main方法第一句SprinklerSystem sprinklers = new SprinklerSystem(); eclipse報出的錯是No enclosing instance of type WaterSource is accessible. Must qualify the allocation with an enclosing instance of type WaterSource (e.g. x.new A() where x is an instance of WaterSource).請問這是為什么?
查看完整描述

2 回答

?
我是偶哦

TA貢獻10條經(jīng)驗 獲得超3個贊

public class SprinklerSystem { -->?public static class SprinklerSystem { ? 這是內(nèi)部類的語法,內(nèi)部靜態(tài)類不需要有指向外部類的引用。但非靜態(tài)內(nèi)部類需要持有對外部類的引用。

查看完整回答
1 反對 回復(fù) 2016-09-28
  • 2 回答
  • 4 關(guān)注
  • 1653 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號