我想在不使用分號的情況下打印「hello」。使用for循環打印時你好我知道println和printf都可以用於打印你好。但是,如果只有printf用於打印hello.When在if語句中使用println時,它顯示「void type not permitted here」。這個錯誤的含義是什麼以及爲什麼println不能在if語句中使用?爲什麼在打印hello時使用「printf」而不是「println」if語句
public class withoutsemicolon
{
public static void main(String [] args)
{
for(int i=0;i<=4;System.out.println("hello"+i+"\n"),i++)
{}
if(System.out.println("hello"+"\n")!=null)
{}
}
}
因此,先生普爾斯告訴我如何打印你好,而不使用分號 – user8340003
爲什麼?爲什麼?請告訴我爲什麼你要這樣做? – Oleg
在採訪中詢問了問題 – user8340003