程序源入坑之路1

来源:互联网 发布:手机金山数据恢复大师 编辑:程序博客网 时间:2024/06/08 06:39

IDE:代码编译器
JDK: Java 语言的软件开发工具包
JRE:运行JAVA程序所必须的环境的集合,包含JVM标准实现及Java 核心类库。
JVM:java虚拟机
标识符:标识符是用户编程时使用的名字,对于变量、常量、函 数、语句块也有名字;我们统统称之为标识符。
关键字:是电脑语言里事先定义的,有特别意义的标识符,有时又叫保留字,还有特别意义的变量。Java语言规定关键字不能作为标识符。
基本数据类型
byte(字节)
shot(短整型)
int(整型)
long(长整型)
float(浮点型)
double(双精度)
char(字符型)
boolean(布尔型)
对象:拥有属性的东西
抽象类:使用了关键词abstract声明的类叫作“抽象类”。如果一个类里包含了一个或多个抽象方法,类就必须指定成abstract(抽象)。
接口:是一系列方法的声明,是一些方法特征的集合,一个接口只有方法的特征没有方法的实现,因此这些方法可以在不同的地方被不同的类实现,而这些实现可以具有不同的行为(功能)。
静态方法:static,可以直接被调用,无需实例化。
`public class Ch1 {
private double width;
private double height;

public Ch1() {    // TODO Auto-generated constructor stub}public Ch1(double width,double height){    this.width=width;    this.height=height;}public double getWidth(){    return this.width;}public void setWidth(double width){    this.width=width;}public double getHeight(){    return this.height;}public void setHeight(double height){    this.height=height;}public static void main(String[] args) {    Ch1 i1=new Ch1();       i1.setWidth(3);    i1.setHeight(3);    System.out.println("宽为"+i1.getWidth()+"长为"+i1.getHeight());}

}`

public class Account {    private String name;    private String pwd;    private double money;    public Account(){    }    public Account(String name,String pwd,double money){        this.name=name;        this.pwd=pwd;        this.money=money;    }    public double deposit(double a){        this.money=this.money-a;        return a;    }    public void draw(double b){        this.money=this.money+b;    }    public void showMoney(){        System.out.println("账户余额"+this.money);    }    public String getName(){        return this.name;    }    public void setName(String name){        this.name=name;    }    public String getPwd(){        return this.pwd;    }    public void setPwd(String pwd){        this.pwd=pwd;    }    public double getMoney() {        return money;    }    public void setMoney(double money) {        this.money = money;    }    public static void main(String[] args){        Account zh=new Account("zhangluoyuan","1401030118",10000);        double n=zh.deposit(50);        zh.draw(200);        zh.showMoney();    }}
0 0
原创粉丝点击