问题描述:
selection does not contain a main type的问题
import java.util.Scanner;
public class Population {
private String name;
private int population;
private double growthRate;
public void readInput()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("what is the species' name ");
name = keyboard.nextLine();
System.out.print("what is the popution of lll");
population = keyboard.nextInt();
while (population < 0);
{
System.out.println("population can not be negatived");
System.out.print("Reenter population:");
population = keyboard.nextInt();
}
System.out.println("Enter growth rate:");
growthRate = keyboard.nextDouble();
}
public void writeOutput()
{
System.out.println("Name = " + name);
System.out.println("Population = " + population);
System.out.println("Goth rate = " + growthRate + "%");
}
}
Java文件也在src下面,为什么就是不能运行呢?写的其他程序就能,怎么解决啊,不要找什么更改目录的回答了
import java.util.Scanner;
public class Population {
private String name;
private int population;
private double growthRate;
public void readInput()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("what is the species' name ");
name = keyboard.nextLine();
System.out.print("what is the popution of lll");
population = keyboard.nextInt();
while (population < 0);
{
System.out.println("population can not be negatived");
System.out.print("Reenter population:");
population = keyboard.nextInt();
}
System.out.println("Enter growth rate:");
growthRate = keyboard.nextDouble();
}
public void writeOutput()
{
System.out.println("Name = " + name);
System.out.println("Population = " + population);
System.out.println("Goth rate = " + growthRate + "%");
}
}
Java文件也在src下面,为什么就是不能运行呢?写的其他程序就能,怎么解决啊,不要找什么更改目录的回答了
问题解答:
我来补答展开全文阅读