<b id="yt35u"></b>
  • <b id="yt35u"></b>

  • <tt id="yt35u"><form id="yt35u"></form></tt>
    <button id="yt35u"></button>

    <button id="yt35u"></button>

    <strike id="yt35u"><dfn id="yt35u"></dfn></strike>

    <i id="yt35u"></i>
    1. <tt id="yt35u"></tt>
      <b id="yt35u"><sub id="yt35u"><tr id="yt35u"></tr></sub></b>

      教育路上

      全國站>Java>Java初學>構造方法為成員變量賦值
      學員需求

      構造方法為成員變量賦值

      摘要:構造方法為成員變量賦值。以下是我們為大家整理的,相信大家閱讀完后肯定有了自己的選擇吧。

      2022-12-02 16:16網絡推薦

      發布時間:
      2022-12-02 16:16
      信息來源:
      網絡推薦
      瀏覽次數:
      1410
      構造方法為成員變量賦值

      package zhang7;
      import zhang7.student;
      
      public class test {
      
      	public static void main(String[] args) {
      		student.schoolname="重慶中學";
      		student s1=new student();
      		s1.setxx("zhangsan", 90.6f, 98.5f, 87.9f);
      		s1.count();
      		System.out.println("zhangsan"+s1.schoolname +s1.getaverage()+s1.dengji());
      	
      
      	}
      
      }
      
      
      
      
      
      
      
      package zhang7;
      
      public class student {
      	private String name;
      	private float ywscore;
      	private float sxscore;
      	private float yyscore;
      	static String schoolname;
      	private float average;
      	
      	void setxx(String name,float ywscore,float sxscore,float yyscore) {
      		this.name=name;
      		this.ywscore=ywscore;
      		this.sxscore=sxscore;
      		this.yyscore=yyscore;
      	}
      	
      	student(){
      		
      	}
      	
      	student(String name,float ywscore,float sxscore,float yyscore){
      		this.name=name;
      		this.ywscore=ywscore;
      		this.sxscore=sxscore;
      		this.yyscore=yyscore;
      	}
      	
      	void count() {
      		this.average=(ywscore+sxscore+yyscore)/3;
      	}
      	
      	float getaverage() {
      		return average;
      	}
      	
      	String dengji() {
      		String str="";
      		if(average>90)
      			str="優秀";
      		else if(average>80)
      			str="良好";
      		return str;
      	}
      	
      
      }
      

      上一篇:
      student學生類的封裝和構造方法的賦值
      下一篇:
      Java 構造方法的定義
      標簽: 成員變量
      網友評論
      發布評論

      訪客的評論 2023/11/08 20:44

      文中描述的是準確的嗎,如何報名!

      我也來發表評價關閉
      我對該內容的評價:
      0
      評價500
      驗證碼: 看不清 換一張
      提交 (匿名發布,無須擔心別人知道您的身份)
      學校免費發布信息關閉
      我們審核后會盡快展示,如有圖片請發郵件到:edu63@foxmail.com

      姓      名:

      內      容:

      手機號碼:

      驗  證  碼:  換一張

      確認提交
      填寫需求信息關閉
      我們會根據您的需求匹配并審核留言

      姓      名:

      意向城市:

      留      言:

      手機號碼:

      驗  證  碼:  換一張

      確認提交
      完善補充本文信息關閉
      非常感謝您幫助完善補充本文信息


       換一張

      確認提交
      女班长给我看她的小内内

        <b id="yt35u"></b>
    1. <b id="yt35u"></b>

    2. <tt id="yt35u"><form id="yt35u"></form></tt>
      <button id="yt35u"></button>

      <button id="yt35u"></button>

      <strike id="yt35u"><dfn id="yt35u"></dfn></strike>

      <i id="yt35u"></i>
      1. <tt id="yt35u"></tt>
        <b id="yt35u"><sub id="yt35u"><tr id="yt35u"></tr></sub></b>