package com.company; // 包 包名
/*
? ? ? ? public? 公有的,公共的? 其他的程序都可以訪問,最大的極限,其他程序都能訪問? ? ? ? class? 類? ? ? ? Main? 類的名稱 ,隨便取名字,最好有意義,一般要求首字母大寫*/
public class Main {
/*
? ? ? ? public? 公有的,公共的? 其他的程序都可以訪問,最大的極限,其他程序都能訪問? ? ? ? static? 靜態(tài)的? ? ? ? ? 沒有對象也可以調(diào)用,屬于公共資源? ? ? ? void? ? ? 空? ? ? ? ? 方法的返回值,由于main是主方法,不需要給任何程序返回內(nèi)容,因此就寫空? ? ? ? main? ? ? 主要的? ? ? ? 方法的名字,可以隨便取,但是入口主方法只能寫成main ,自定義的方法名可以自己取,建議有意義,首字母小寫,駝峰命名法
? ? ? ? (string[] args)? ? ? ? 方法的參數(shù) String[] -> 參數(shù)的類型 args? 數(shù)組的名字*/
? ? public static void main(String[] args) {
//? 對象的創(chuàng)建? 類型? 對象名 = new 類名()
? ? ? ? Student xujinwei =new Student();
? ? ? ? //? 屬性的賦值
? ? ? ? xujinwei.name ="徐大大" ;
? ? ? ? xujinwei.age =20 ;
? ? ? ? xujinwei.sex ='男' ;
? ? ? ? xujinwei.high =180.00;
? ? ? ? xujinwei.height =100.88;
? ? ? ? //? 屬性的調(diào)用
? ? ? ? System.out.println(xujinwei.name);
? ? ? ? System.out.println(xujinwei.age);
? ? ? ? System.out.println(xujinwei.sex);
? ? ? ? System.out.println(xujinwei.high);
? ? ? ? System.out.println(xujinwei.height);
? ? ? ? //? 方法的調(diào)用
? ? ? ? xujinwei.eat();
? ? ? ? xujinwei.play();
? ? ? ? xujinwei.sleep();
? ? }
}