帮忙改一下Java小程序
package第五章;importjava.util.*;classStudents{publicStringname,sex;doubleage,gread;publi...
package 第五章;
import java.util.*;
class Students {
public String name,sex;
double age,gread;
public void setname(String a){
name=a;
}
public String getname(){
return name;
}
public void setsex(String b){
sex=b;
}
public String getsex(){
return sex;
}
public void setage(double c){
age=c;
}
public double getage(){
return age;
}
public void setgread(double d){
gread=d;
}
public double getgread(){
return gread;
}
}
public class Student{
public static void main(String args[]){
Students p=new Students();
System.out.println("请输入姓名");
String a=in.nextString();
System.out.println("请输入姓别");
String b=in.nextString();
System.out.println("请输入年龄");
double c=in.nextDouble();
System.out.println("请输入班级");
double d=in.nextDouble();
System.out.println(p.getname());
System.out.println(p.getage());
System.out.println(p.getsex());
System.out.println(p.getgread());
}
} 展开
import java.util.*;
class Students {
public String name,sex;
double age,gread;
public void setname(String a){
name=a;
}
public String getname(){
return name;
}
public void setsex(String b){
sex=b;
}
public String getsex(){
return sex;
}
public void setage(double c){
age=c;
}
public double getage(){
return age;
}
public void setgread(double d){
gread=d;
}
public double getgread(){
return gread;
}
}
public class Student{
public static void main(String args[]){
Students p=new Students();
System.out.println("请输入姓名");
String a=in.nextString();
System.out.println("请输入姓别");
String b=in.nextString();
System.out.println("请输入年龄");
double c=in.nextDouble();
System.out.println("请输入班级");
double d=in.nextDouble();
System.out.println(p.getname());
System.out.println(p.getage());
System.out.println(p.getsex());
System.out.println(p.getgread());
}
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询