所以我想制作一個命令行計算器,它在“Calculator”一詞之后接受多個參數(shù)。但使用以下代碼我無法實(shí)現(xiàn)它。在這兩種方法中,gradle 都會在顯示單詞“Calculator”之前等待讀取該行。使用掃描儀System.out.print("Calculator ");Scanner sc = new Scanner(System.in);String inputString;inputString = sc.nextLine();String[] args = inputString.split( "\\s+" );使用BufferReaderBufferedReader br = new BufferedReader(new InputStreamReader(System.in));System.out.print("Calculator ");String str= br.readLine();String[] args = str.split( "\\s+" );但是 System.out.println("Calculator ") 顯示該單詞沒有任何問題。但它并不在一條線上。所以它不能按我想要的方式工作。更改代碼行的順序也沒有幫助。System.Console().printf() 也不是一個選項(xiàng),因?yàn)槲沂褂玫氖?Intellij IDEA。那么有人可以幫我解決這個問題,以便我可以獲得內(nèi)聯(lián)輸入閱讀器。我還嘗試通過在方法中單獨(dú)實(shí)現(xiàn)來同步打印方法。那效果不太好。最后我想要實(shí)現(xiàn)的是以下格式計算器 最大 12 23 25 45這里斜體是要讀取的輸入。粗體部分應(yīng)由程序打印。這是完整的代碼
1 回答

倚天杖
TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個贊
您需要定義您的reference type
in?CouchbaseRepository<T, K>
,然后只需添加引用類型Item
asCouchbaseRepository<BendicionesDoc<Item>, String>
并僅使用存儲庫查詢關(guān)鍵字for?findById(String id)
。
public?interface?BenRepository?extends?CouchbaseRepository<BendicionesDoc<Item>,?String>?{? ????List<BendicionesDoc<Item>>?findById(String?id); }
添加回答
舉報
0/150
提交
取消