内部类不能有静态声明 下面程序在编译时提示的88行,public static void main(String[] args)

内部类不能有静态声明 下面程序在编译时提示的88行,public static void main(String[] args),第1张

ExecDemo类定义错地方了念信,要放到class Student外面

class Student{

private String name

private int age

private float computer

private float english

private float math

public Student(){}

public Student(String n,int a,float b,float c,float d){

this.setName(n)

this.setAge(a)

this.setComputer(b)

this.setEnglish(c)

this.setMath(d)

}

public float sum(){

return english+computer+math

}

public float avg(){

return this.sum() / 3

}

public float max(){

float max=computer>english?computer:english

max=max>仔没轮math?max:math

return max

}

public float min(){

float min=computer<english?computer:english

min=min<math?min:math

return min

}

public String getInfo(){

return"学生信息:\n"+

"\t|-姓名:"+this.getName()+"\n"+

"\t|-年龄:"+this.getAge()+"\n"+

"\t|-计算机成绩察扮:"+this.getComputer()+"\n"+

"\t|-英语成绩:"+this.getEnglish()+"\n"+

"\t|-数学成绩:"+this.getMath()

}

public void setName(String n){

name=n

}

public void setAge(int a){

age=a

}

public void setComputer(float b){

computer=b

}

public void setEnglish(float c){

english=c

}

public void setMath(float d){

math=d

}

public String getName(){

return name

}

public int getAge(){

return age

}

public float getComputer(){

return computer

}

public float getEnglish(){

return english

}

public float getMath(){

return math

}

}

public class ExecDemo{

public static void main(String[] args){

Student stu=new Student("张三",20,95.0f,94.0f,67.0f)

System.out.println("总分:"+stu.sum())

System.out.println("平均分:"+stu.avg())

System.out.println("最高分:"+stu.max())

System.out.println("最低分:"+stu.min())

System.out.println(stu.getInfo())

}

}

没关系的,

你稍等下,会关掉的,不许要点强制关闭。其实这是强制关闭程序,和强制关机是不一样的,对电脑没影响。

这种情况是因为有进程正在坦春运行,你平时关机之前如让纤耐果把之前打开的软件都关掉,然后稍等一分钟再关机,也许就会比较顺利了。

我的电脑有时也是这样,不用理他,几秒中就自动关机了。

网上有一种解决具体方法是,没有试过,竖脊给你参考一下。

首先点击开始菜单,在搜索框中输入“gpedit.msc”启动组策略编辑器。依次找到并展开

“计算机配置”→“管理模板”→“系统”→“关机选项”,双击“关闭会阻止或取消关机的应用程序的自动终止功能”并修改为“已启用”。这样当再遇到未关闭

程序时,Windows

7将自动终止。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/8195397.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存