println

    0熱度

    2回答

    class Test { int a = 100; System.out.println(a); } class Demo { public static void main(String args[]) { Test t = new Test(); } } 我是新手編程。我在練習時發現了這個代碼。我不明白爲什麼我得到這個錯誤。 這是我

    0熱度

    1回答

    我有一個Location類,存儲多個位置對象,從JSON文件中解析。目前,我可以使用toString()方法在列表中打印所有位置。輸出看起來是這樣的: http://hastebin.com/eruxateduz.vhdl 這是列表中的loctions的一個示例: Location [location=null, id=3, description=You are at battlefield o

    0熱度

    1回答

    我想弄清楚爲什麼我的鑽石並沒有完全形成在底部。當用戶輸入任何大於三的奇數時,鑽石在底部不能正確地形成(它僅在最大中線後面打印一行)。它看起來像這樣(我想在這個例子中五行): * * * * * * * * 我相信有什麼毛病了對於被認爲創造了鑽石底環。代碼爲: //bottom of the diamond for(j = (in + 1)/2; j <

    2熱度

    1回答

    我在swift操場內有一種奇怪的行爲。 當我輸入的代碼 println("test 1" + "test 2" + "test 3" + "test 4") //compiles println("test 1" + "test 2" + "test 3" + "test 4" + "test 5") //compiles println("test 1" + "test 2" + "test

    -3熱度

    2回答

    我剛開始學習Java並遇到問題,希望您能幫助我。 import java.util.Date; public class Main { /** * @param args the command line arguments */ public void main(String[] args) { // TODO code application logic here } Da

    1熱度

    4回答

    我的程序應該要求用戶輸入一些數值,並且應該根據選擇的菜單選項打印出這些數值(在我的情況下,它是)。我用System.out.println("Your name: " + name);來打印出用戶插入的名字,但不幸的是它不能打印出名字。該行只剩下空白。爲什麼這樣?我該如何解決它。 public static void main(String[] args) { Scanner sc =

    2熱度

    3回答

    我已經開始學習Java被稱爲3倍System.in.read()後,寫了幾個很容易的事情,但是是我不明白一件事: public static void main(String[] args) throws java.io.IOException { char ch; do { System.out.println("Quess the letter")

    -3熱度

    2回答

    我想寫打印輸出的程序: ** **** ****** ******** ********** 我想出什麼樣的主意: public class Loops { public static void main(String[] args) { for(int i=1; i<=5; i++) { for(int j=0; j<i; j++) { Syst

    2熱度

    4回答

    public class Test2{ public static void mystery(int x, int y, boolean b, String s) { System.out.println(x*3 + "..." + x/y); if (b) System.out.println("yes"); else System.out.println("no"); for (

    0熱度

    3回答

    我創建了一個命令行工具,做一些長期的行動,我想通過打印語句通知用戶,如: "10% Done" "20% Done" 上有多大比例的操作完成。如果我使用println,每個進度將被打印到一個新行(顯然),但是有一種快捷方式,我可以用新的文本替換上一次打印的文本,所以在控制檯上,您只能讀取實際百分比,而不是實際的和之前打印的那些?