代码拉取完成,页面将自动刷新
import java.util.Scanner;
public class hw{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int height, width;
char status; //运用重载方法
height = in.nextInt();
width = in.nextInt();
Board board = new Board(height, width);
status = board.getStatus();
System.out.print(status);
}
}
class Board{
int height, width;
public Board(int height, int width){
this.height = height;
this.width = width;
}
public char getStatus(){
int A=1,B=0;
if(height<=width){
return status(1);
}else{ //定义不同类型的返回值
return status(1.0);
}
}
public char status(double rate){
System.out.println("B"); //double为竖着放
return 0; //返回主类输出B
}
public char status(int rate){
System.out.println("A"); //int为平着放
return 0; //返回主类输出A
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。