以下是我的解决方法:
package zh.codegym.task.task04.task0429;
/*
正数和负数
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());//在此编写你的代码
int b = Integer.parseInt(reader.readLine());//在此编写你的代码
int c = Integer.parseInt(reader.readLine());//在此编写你的代码
int count1 = 0;
int count2 = 0;
if (a>0){
count1++;
}
else if (a<0){
count2++;
}
if (b>0){
count1++;
}
else if (b<0){
count2++;
}
if (c>0){
count1++;
}
else if (c<0){
count2++;
}
System.out.println("负数个数: " + count2);
System.out.println("正数个数: " + count1);
}
}