蜜汁bug,顯示運行出錯timeout,但在eclipse里成功運行
看了一下感覺代碼沒問題但是網頁上運行不出來,去eclipse上成功運行,這是什么原理?難道是傳說中的運行環境的問題?
public class HelloWorld {
? ? public static void main(String[] args) {
????String s1 = "imooc";
????String s2 = "imooc";
? ? ? ??
? ? //定義字符串s3,保存“I love”和s1拼接后的內容
?????String s3 = "I love "+ s1;
? ? ?// 比較字符串s1和s2
????// imooc為常量字符串,多次出現時會被編譯器優化,只創建一個對象
????System.out.println("s1和s2內存地址相同嗎?" + (s1 == s2));
? ? ? ??
? ? ? //比較字符串s1和s3
????System.out.println("s1和s3內存地址相同嗎?" +(s1 == s3));
????String s4 = "I love " + s1;
? ? //比較字符串s4和s3
????// s1是變量,s4在運行時才知道具體值,所以s3和s4是不同的對象
????System.out.println("s3和s4內存地址相同嗎?" + (s4 == s3));
}
}
2018-07-23
timeout? 估計網卡吧,你是通過網頁提交代碼到服務器。eclipse是在本地運行的
2018-08-20
好像第一次必須運行正確,只要錯了就不行
2018-08-07
你的頭像讓我想以一個人