class Max
{
public static void main(String[] args){
//在main方法里调用函数
int max = compare(2,20);
System.out.println("max="+max);
boolean flag= equls(10,20);
System.out.println("flag="+flag);
rectangle(4,5);
}
public static int compare(int a,int b){
return a>b?a:b;
}
public static boolean equls(int a,int b){
return a==b;
}
public static void rectangle(int intheight ,int width){
for (int x=0;x<intheight;x++ )
{
for (int y=0;y<width;y++)
{
System.out.print("*");
}
System.out.println();
}
}
} |
|