java se web向需要的资料整理1
来源:互联网 发布:sql数据库安全性 编辑:程序博客网 时间:2024/06/07 10:38
首先,j2se 建议用editplus来写(因为本身不会很难)
1.思想:封装继承多态
单纯从简单的角度来说:封装就是getset的爪哇豆子。。//口胡的。。其实是用java语言编写的可重用的软件组件
(私有成员变量,private int age; public get()/set())
继承:下面helloworld里的class C,Base,父节点,基(父)类
多态:子类实例化后把实例化的对象交给父类操控(类似)或者交给接口来传递值。
EG:Father f = new Son();←class Son extends Father
2.8个基本数据类型,.java文件命名规则
基本类型:byte short int long float double boolean char
.java文件命名规则 _$+英文开头
3.hello world(加强版)
interface B{// this is a interfacepublic void bbb();}class C{//// this is a BaseApublic void use(String s){if(s.equals("Hello world"))System.out.println("yeah,I'm java.Greeting to you");}}public class A extends C implements B{// We can use constructor to Say startpublic A(){System.out.print("This is a Start.");System.out.println("");}// We should implement bbb methodpublic void bbb(){this.use("Hello world");}public static void main(String args[]){new A().bbb();}}
3. new instance(很多名词基于英文讲比较实在,渣英文如有错误,请各位看官指出谢谢。。)
As we all known,java is a object-oriented language.So if you want to use class,you should instantiate it.eg:helloworld.java--new A()
But this isn't which we want to do.If class A() has another method.new A().ccc()??
terrible...So the normal new instance is to give it a handle(a);
eg: A a = new A(); a.bbb(); a.ccc();
So helloworld.java main method is modified to:
public static void main(String args[]){ //new instance A a = new A(); a.bbb(); }
注:本身想用多态但懒(拖走。。)。。。。
顺便。其实把A改成B就可以了。。。。(打死。。)
4.constructor method,override(overwriting and overloading,this and super)
member method and constructor method's difference.
member method has a return object.constructor not.
member:If you want to use, you should handle.method
constructor:new class(),it will start to run.
eg:
class A{ public A(){ System.out.println("This is constructor"); } public void aa(){ System.out.println("This is Member method"); } public static void main(String args[]){ new A(); System.out.println("====================="); new A().aa(); }}
override:
1.overwriting
baseClass B has method aa()
extendClass A has method aa()
we use aa() is Class A not Class B.(normal)
2.overloading
Class A has two or more constructor,like aa(),aa(String s) etc.
eg:
class BaseA{ public void AA(){ System.out.println("AA"); } } class A extends BaseA{ public A(){ System.out.println("overloading with no Parameter"); } public A(String s){ System.out.println("overloading with String"); } public void AAA(){ super.AA(); System.out.println("================="); System.out.println("this is overwriting AAA"); this.AA(); } public void AA(){ System.out.println("this is overwriting AA"); } public static void main(String args[]){ new A();// overloading with no Parameter System.out.println("==================="); new A("AA");// overloading with String System.out.println("==================="); new A().AAA(); /* overloading with no Parameter * AA * ================= * this is overwriting AAA * this is overwriting AA */ System.out.println("==================="); } }
- java se web向需要的资料整理1
- java se web向需要的资料整理2(更新中)
- java-web 资料整理
- 需要整理的一些资料
- Java SE与Java Web的学习
- 整理 java SE基础知识
- java Web开发必备资料整理
- java Web开发必备资料整理
- 1 java se/ee/me java web
- Java、Java SE、Java Web和Java EE的区别
- java SE学习初步整理
- Java SE的复习1
- Java SE 8 资料网址备忘
- Java SE 6 的 Web Service 之旅
- Java SE 6 的 Web Service实例演示
- 我的java资料网站整理
- 外国程序员整理的Java资料大全
- 最近的java学习资料整理
- 解决: ubuntu登录后无法进入桌面
- 多目录Makefile(库及分层目录)
- MyEclipse 安装 使用 Python
- 移位寄存器模型.v
- delphi excel 单元格合并
- java se web向需要的资料整理1
- linux服务器不能访问外网的问题
- Delphi操作Excel详解1
- 为程序员量身定制的12个目标
- delphi与Excel 2
- 最大子段和(动态规划法求解)
- 多态总结
- Microsoft Visual Studio 2008破解方法
- JQuery插件第十八个:高级搜索集成处理