上一页 1 ··· 9 10 11 12 13 14 下一页
摘要: 1. 抽象函数的语法特征2. 抽象类的语法特征3. 抽象类的作用1. 抽象函数的语法特征 只有函数的定义,没有函数体的函数被称为抽象函数 abstract void fun(); Tips : abstract 抽象; 摘要;2. 抽象类的语法特征 抽象类不能生成对象 一个类包含抽象函数, ... 阅读全文
posted @ 2014-05-19 16:17 Mirrorhanman 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 1.被客户不断变化的需求 “折磨”第一次需求 class Printer{ void Open(){ System.out.println("Open"); } void Close(){ System.out.println("Close");... 阅读全文
posted @ 2014-05-19 15:05 Mirrorhanman 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1. 对象的向上转型2. 对象的向下转型本节学语法, 应用在以后 !!!1. 对象的向上转型 实例:电脑(父类) 笔记本电脑(子类) -- 我正在使用的笔记本电脑(子类的对象) 我正在使用的笔记本电脑 是 电脑 (将子类对象赋值给父类的引用) 代码:Student 是 Person 的子类 ... 阅读全文
posted @ 2014-05-19 10:04 Mirrorhanman 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 1. 函数的复写(override)2. 使用super调用父类的成员函数1. 函数的复写 修改父类中成员函数, 就叫复写2. 使用super调用父类的成员函数 this()就可调用本类的构造函数, this.函数名 即可调用本类的成员函数 super()可调用父类的构造函数, super.函数名 ... 阅读全文
posted @ 2014-05-19 09:28 Mirrorhanman 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1.生成子类的过程2.使用super调用父类构造函数的方法上一节是用extends继承父类的 成员变量 和 成员函数, 但不能继承构造函数!!!1.生成子类的过程 Person.java class Person{ String name ; int age ; Pers... 阅读全文
posted @ 2014-05-18 23:26 Mirrorhanman 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 1. 什么是继承2. 为什么要使用继承3. 继承的基础语法三个常用 继承, 封装, 多态1. 什么是继承 继承就是儿子得到老子的东西 面向对象世界当中, 继承就是一个类得到了另外一个类的成员变量和成员函数 Java中一个子类只能继承一个父类 , C++可继承多个父类, 多继承 Eg.Person.... 阅读全文
posted @ 2014-05-18 22:11 Mirrorhanman 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1. 静态成员变量的语法特点2. 静态函数的语法特点3. 静态代码块的语法特点1. 静态成员变量的语法特点 静态成员变量可直接通过类名调用 VS 静态成员变量值共用一个 Person.java public class Person{ static int i; } Test... 阅读全文
posted @ 2014-05-18 21:39 Mirrorhanman 阅读(1880) 评论(0) 推荐(0) 编辑
摘要: 1. this调用成员变量和成员函数2. this调用构造函数1. Person.java public class Person{ String name ; void talk(){ System.out.println("my name is " + this.... 阅读全文
posted @ 2014-05-17 01:36 Mirrorhanman 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 1. 函数的重载2. 构造函数的作用1. 函数的重载 Chongzai.java class Chongzai{ void funA(){ System.out.println("没有参数的funA函数"); } void funA(int i){ System.out.pr... 阅读全文
posted @ 2014-05-17 00:59 Mirrorhanman 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1. 对象属性的使用方法2. 多对象的创建方法3. 匿名对象的创建和使用方法1. 对象属性的使用方法 使用对象调用变量和函数 1. 对象.变量 2. 对象.函数() Dog.java class Dog{ String name ; int age ; String color ; void ju... 阅读全文
posted @ 2014-05-16 11:05 Mirrorhanman 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1.创建类的方法 面向对象的程序都是类堆积起来的2.创建对象的方法3.类和对象关系1.创建类的方法 class 类名{ 属性; //也叫成员变量, 主要用于描述类的状态 方法; //也叫成员方法, 主要用于描述类的行为 } class Person{ int age; //属性 or 类的成... 阅读全文
posted @ 2014-05-16 10:07 Mirrorhanman 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 1. 什么是面向对象2. 应该如何学习面向对象3. 面向对象的思维方式1. 什么是面向对象 面向对象是一种编程方法 面向对象是一种思维方式 面向对象不是一种编程语言2. 应该如何学习面向对象 掌握一门面向对象语言的语法 掌握面向对象的思维方式 C语言 面向过程, 模拟CPU执行指令的顺序编写 而 面... 阅读全文
posted @ 2014-05-16 09:38 Mirrorhanman 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Eg1. 打印出 100 - 200 之间的素数 public class Ex5{ public static void main(String args []){ for (int i = 100 ;i < 201; i++){ boolean b = false ; ... 阅读全文
posted @ 2014-05-15 17:16 Mirrorhanman 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1.循环结构2.for循环语句3.while循环语句 阅读全文
posted @ 2014-05-15 16:56 Mirrorhanman 阅读(83) 评论(0) 推荐(0) 编辑
摘要: Eg1. public class Ex4{ public static void main(String args []){ int score = 90 ; if (score > 85 && score 75 && score 60 && score =... 阅读全文
posted @ 2014-05-15 16:50 Mirrorhanman 阅读(116) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 下一页