java文件运行时出现applet和java程序选择提醒
importjava.util.Scanner;classKichenAndRabbit{intx,y,z;KichenAndRabbit(intx,inty){Syst...
import java.util.Scanner;class KichenAndRabbit{ int x, y, z; KichenAndRabbit(int x , int y) { System.out.println("鸡和兔子的数量:"+ x + y); } void setKichenNum(int _x) { x = _x; } void setRabbitNum(int _y) { y = _y; }}public class Method { public static void mian(String[] args) { Scanner a = new Scanner(System.in); System.out.println("请输入鸡的数量"); int m = a.nextInt(); System.out.println("请输入兔子的数量"); int n = a.nextInt(); KichenAndRabbit A = new KichenAndRabbit( m , n); System.out.println("请第二次输入鸡的数量"); int x = a.nextInt(); A.setKichenNum(x); System.out.println("请第二次输入兔子的数量"); int y =a.nextInt(); a.close(); A.setKichenNum(y); System.out.println(A); }}
展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询