package fightClub;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Введите имя первого кота: ");
String nameFirstCat = scanner.nextLine();
System.out.print("Введите вес первого кота: ");
int weigthFirstCat = scanner.nextInt();
Cat firstCat = new Cat();
firstCat.setName(nameFirstCat);
firstCat.setWeigth(weigthFirstCat);
System.out.print("Введите имя второго кота: ");
String nameSecondCat = scanner.nextLine();
System.out.print("Введите вес второго кота: ");
int weigthSecondCat = scanner.nextInt();
Cat secondCat = new Cat();
secondCat.setName(nameSecondCat);
secondCat.setWeigth(weigthSecondCat);
System.out.println(firstCat.getName() + " " +
firstCat.getWeigth());
System.out.println(secondCat.getName() + " " +
secondCat.getWeigth());
}
}
控制台:输入第一只猫的名字:Lory 输入第一只猫的重量:5 输入第二只猫的名字:输入第二只猫的重量:6 Lory 5 6