链接:http://www.cnblogs.com/vamei/archive/2013/03/31/2991531.html

java快速教程第1课 从HelloWorld到面向对象

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/14/2958654.html

java快速教程第2课 方法与数据成员

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/25/2964430.html

java快速教程第3课 构造器与方法重载

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/26/2981728.html

java快速教程第4课 封装与接口

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/27/2982209.html

public class Test
{public static void main(String[] args){Human aPerson = new Human(160);System.out.println(aPerson.getHeight());aPerson.growHeight(170);System.out.println(aPerson.getHeight());aPerson.repeatBreath(100);}}class Human
{/*** constructor*/public Human(int h){this.height = h;System.out.println("I'm born");}/*** accessor*/public int getHeight(){return this.height;}/*** mutator*/public void growHeight(int h){this.height = this.height + h;}/*** encapsulated, for internal use*/private void breath(){System.out.println("hu...hu...");}/*** call breath()*/public void repeatBreath(int rep){int i;for(i = 0; i < rep; i++) {this.breath();}}private int height; // encapsulated, for internal use
}

java快速教程第5课 实施接口

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/29/2982206.html

package text;interface Cup
{void addWater(int w);void drinkWater(int w);
}class Text implements Cup
{public void addWater(int w){this.water = this.water + w;System.out.println(water);}public void drinkWater(int w){this.water = this.water - w;System.out.println(water);}public int waterContent( ){return this.water;}public void play( ){System.out.println("la...la...");}private int water = 0;public static void main(String args[ ]){Text obj = new Text( );obj.addWater(10);obj.drinkWater(4);}
}

java快速教程第6课组合

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/29/2982206.html

package text;public class Text
{public static void main(String[] args){Torch aTorch = new Torch( );System.out.println("Charge: 2 hours");aTorch.charge(2);System.out.println("First Turn On: 3 hours");aTorch.turnOn(3);System.out.println("Second Turn On:  3 hours");aTorch.turnOn(3);}
}class Battery
{public void chargeBattery(double p){if (this.power < 1.){this.power = this.power + p;}}public boolean useBattery(double p){if (this.power >= p){this.power = this.power - p;return true;}else{this.power = 0.0;return false;}}private double power = 0.0;
}class Torch
{/***  10% power per hour use*   warning when out of power*/public void turnOn(int hours){boolean usable;usable = this.theBattery.useBattery(hours*0.1);if ( usable != true ){System.out.println("No more usable, must charge");}}/***  20% power per hour charge*/public void charge(int hours){this.theBattery.chargeBattery(hours*0.2);        }/***  composition*/private Battery theBattery = new Battery();
}

java快速教程第7课 包的建立和使用

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/29/2982206.html

java快速教程第8课 继承

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/29/2982232.html

package test;public class Test
{public static void main(String[ ] args){System.out.println("hello world");Woman aWoman = new Woman();aWoman.growHeight(120);System.out.println(aWoman.getHeight());aWoman.breath();aWoman.giveBirth();}
}class Human
{/*** contructor*/public Human(int height){this.height = height;}public Human(){}/*** accessor*/public int getHeight(){return this.height;}/***    * mutator*/public void growHeight(int h){this.height = this.height + h;}/*** breath*/public void breath(){System.out.println("hu...hu...");}private int height;
}class Woman extends Human
{    /*** constructor*/public Woman(int h){super(h); //base class construtorSystem.out.println("Hello, Pandora!");}public Woman(){}/***  new method*/public Human giveBirth(){    System.out.println("Give birth");return (new Human(20));}/*** override Human.breath( )*/public  void breath(){super.breath( );System.out.println("su...");}
}

java快速教程第9课  类数据与类方法

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/31/2988622.html

package test;public class Test
{public static void main(String[ ] args){System.out.println(Human.getPopulation());Human aPerson = new Human(160);System.out.println(aPerson.getPopulation());}
}class Human
{   /*** constructor*/public Human(int h){this.height = h;Human.population = Human.population +1;}/*** accessor*/public int getHeight(){return this.height;}/*** mutator*/public void growHeight(int h){this.height = this.height + h;}/*** breath*/public void breath(){System.out.println("hu...hu...");}private int height; /** static method, access population*/public static int getPopulation(){return Human.population;}private static int population;private static boolean is_mammal = true;}

java快速教程第10课 接口的继承与抽象类

学习网址:http://www.cnblogs.com/vamei/archive/2013/03/31/2982240.html

java快速教程第11课 对象引用

学习网址:http://www.cnblogs.com/vamei/archive/2013/04/01/2992484.html

package test;public class Test
{public static void main(String[] args){Human aPerson = new Human(160);Human dummyPerson = aPerson;System.out.println(dummyPerson.getHeight());aPerson.growHeight(20);System.out.println(dummyPerson.getHeight());}
}class Human
{   /*** constructor*/public Human(int h){this.height = h;}/*** accessor*/public int getHeight(){return this.height;}/*** mutator*/public void growHeight(int h){this.height = this.height + h;}private int height;
}

java快速教程第12课 多态

学习网址:http://www.cnblogs.com/vamei/archive/2013/04/01/2992662.html

将一个衍生类引用转换为其基类引用,这叫做向上转换(upcast)或者宽松转换。

转载于:https://www.cnblogs.com/yzmb/p/3907111.html

Java快速教程--vamei 学习笔记(基础篇)相关推荐

  1. Redis学习笔记①基础篇_Redis快速入门

    若文章内容或图片失效,请留言反馈.部分素材来自网络,若不小心影响到您的利益,请联系博主删除. 资料链接:https://pan.baidu.com/s/1189u6u4icQYHg_9_7ovWmA( ...

  2. MySQL学习笔记-基础篇1

    MySQL 学习笔记–基础篇1 目录 MySQL 学习笔记--基础篇1 1. 数据库概述与MySQL安装 1.1 数据库概述 1.1.1 为什么要使用数据库 1.2 数据库与数据库管理系统 1.2.1 ...

  3. MySQL学习笔记-基础篇2

    MySQL学习笔记-基础篇2 目录 MySQL学习笔记-基础篇2 8.子查询 8.1 需求分析与问题解决 8.1.1 实际问题 8.1.2 子查询的基本使用 8.1.3 子查询的分类 8.2 单行子查 ...

  4. java学习笔记-基础篇

    Java基础篇 1-12 常识 13 this关键字 14参数传递 16 继承 17 访问权限 28-31异常 1-12 常识 1.文件夹以列表展示,显示扩展名,在地址栏显示全路径 2.javac编译 ...

  5. extlink.php,ExtJs 学习笔记基础篇 Ext组件的使用_extjs

    昨天刚接触到Extjs,简单写了篇学习笔记,今天继续. 天介绍一下Ext中组件举几个简单的例子做说明.注意:文章内容有些摘自本人学习过程中看到的资料. Ext2.0对框架进行了非常大的重构,其中最重要 ...

  6. python3多线程编程_Python 3多线程编程学习笔记-基础篇

    本文是学习<Python核心编程>的学习笔记,介绍了Python中的全局解释器锁和常用的两个线程模块:thread, threading,并对比他们的优缺点和给出简单的列子. 全局解释器锁 ...

  7. C++ 学习笔记----基础篇

    (一)类和抽象数据类型   1.通过类实现的接口(公有和私有)可实现信息隐藏.实现对数据的封装等: 2.抽象数据类型(ADT:Abstract Data Type):当一个数据类型仅暴露公有接口,而将 ...

  8. 易语言学习笔记——基础篇

    易语言学习笔记20180710 一. 易语言的数据类型可以分为基本数据类型和特殊数据类型 1.     其中基本数据类型分为: ①   数值型 ②   逻辑型 ③   日期时间型 ④   文本型 ⑤  ...

  9. Java菜鸟教程系列 学习笔记总结 基础篇(1)

    基础语法 本博客通过学习菜鸟教程Java专栏,并整理得出的Java基础知识. 命名规范 1.项目名全部小写 2.包名全部小写 3.类名首字母大写,如果类名由多个单词组成,每个单词的首字母都要大写.如: ...

最新文章

  1. JS 保持数组长度为3位并且值不重复
  2. 深度解析 Lucene 轻量级全文索引实现原理
  3. ssm中shiro的使用
  4. ubuntu kylin 14.04安装配置redis-2.8.9(转)
  5. postgresql 删除触发器_PostgreSQL:我没有带闪,不讲武德
  6. VMware Data Recovery备份恢复vmware虚拟机
  7. 《Head First设计模式》第七章-适配器模式、外观模式
  8. php 数组 js 数组_PHP数组转换为js数组
  9. 2005/2/21 开始查阅有关gis的相关信息
  10. razorPage三元运算符使用注意
  11. 【定位问题】基于matlab三维chan算法求解室内定位问题【含Matlab源码 580期】
  12. android 流量计算器,电工计算器v8.0.1_for Android 直装解锁专业版
  13. matlab中的插值计算函数,MATLAB中的插值函数|全国大学生数学建模竞赛(CUMCM)|MATLAB技术论坛 - Powered by Discuz!...
  14. python中binomial_二项堆python实现——eager binomial heap
  15. iOS --- 使用Mixpanel来统计和分析移动APP的用户数据
  16. (混沌系统)图像加密之Logistic混沌映射matlab仿真
  17. 如何成为Android高手
  18. 洛谷P3354 Riv河流 [IOI2005] 树型dp
  19. 球面三角形的梅涅劳斯定理、塞瓦定理及其应用
  20. LA2402 Fishnet 四边形面积

热门文章

  1. archlinux 安装 Windows 字体
  2. Debian Security Advisory(Debian安全报告) DSA-4410-1 openjdk-8 security update
  3. 【gin-04】 GIN-快速开始
  4. oracle系列(三)oracle的配置与管理
  5. 英特尔九州云99Cloud OpenStack行业应用研讨会
  6. poj——2771 Guardian of Decency
  7. python -- 青少年如何使用 Python 开始游戏开发
  8. 文本过滤--awk 3
  9. NSIS安装制作基础教程
  10. PowerDesigner对列增加注释