21天养成好习惯_第二天
Java基础学习
Java的核心是面向对象编程(OOP):
以类组织代码 , 以对象组织(封装) 数据
抽象型语言
OOP的三大特性: 封装 , 继承 , 多态
回顾方法及加深
方法的定义:
修饰符<br> 返回类型<br> 方法名<br> 参数列表 <br> 异常抛出<br>
方法的调用 :
静态方法<br> 非静态方法<br> 形参 和 实参 <br> 值传递和引用传递<br> this关键字<br>
类和对象的创建
Application.java
package com.oop;
public class Application {
public static void main(String[] args) {
Students xiaoming = new Students("xiaoming");
xiaoming.age = 20;
xiaoming.say();
Students xiaohong = new Students("xiaohong");
xiaoming.age = 21;
xiaoming.say();
}
}
Students.java
package com.oop;
public class Application {
public static void main(String[] args) {
Students xiaoming = new Students("xiaoming");
xiaoming.age = 20;
xiaoming.say();
Students xiaohong = new Students("xiaohong");
xiaoming.age = 21;
xiaoming.say();
}
}
实例运行结果
其他知识
C++的进阶学习 和 离散数学的学习