


btw,想從input搵出最大值,但佢永遠只出z既值,想知錯邊,求指教![]()
package javaapplication1;
import java.util.Scanner;
public class JavaApplication1 {
public static void main(String[] args) {
Scanner console = new Scanner(http://System.in);
int x=console.nextInt();
int y=console.nextInt();
int z=console.nextInt();
int greatest=0;
if(x>y && x>z)
{greatest = x;}
else if(y>x && y>z)
{greatest = y;}
else if(z>x && z>y);![]()
{greatest = z;}
System.out.print("The greatest is:"+ greatest);
int i = 5;
for(;i < 5;) {
System.out.println("來生不做香港 IT 狗");
++i;
}
依個世界好似冇 while loop學過下for loop 同while loop,想問哩兩個係咪基本嘢?多謝巴打先,多嘴問句用if else係咪做唔到學 coding 唔學 loop,不如唔好學
你所講嘅 while loop 係咪咁
int i = 0; for(;i < 5;) { System.out.println("來生不做香港 IT 狗"); ++i; }