博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Thinking in Java 笔记
阅读量:7194 次
发布时间:2019-06-29

本文共 1559 字,大约阅读时间需要 5 分钟。

hot3.png

1、Method:

Object-oriented programming is often summarized as simply "sending messages to objects"

2、byte:

The size of each of char in a String is 16 bit, or two bytes,to support Unicode characters;

3、OverLoading with primitives

A primitive can be automatically promoted from a smaller type to a larger one;example:

f(long l){},f(float f){},f(double d){}  execute: int a=0; f(a); It will be call f(long l) method;

char produces a slightly different effect,since if it doesn't find a exact char match, it is promoted to int;

others: f(long l) {},f(folat f){} execute: double d=0; f(d)--->error ,f((long)d) and f((float)d) are right;

4、You simply use new to create the elements in the arrary;

int [] a;   int [] b = new int[10];

5、Non-static instance initialzation ;

public Class A {

    private int a;

    {

    a = 10;

    }

}

This syntax is necessary to support the initialization of anonymous inner calsses;

6、final and private 

Any private methods in a class are implicitly final ,Because you can't access a private method, you can't override it.

This issue can confusion ,because if you try to override a private  method, its seems to work, and the complier doesn't give an error message;

"Overriding" can only occur if something is part of the base=class interface. That is , you must be able to upcast an object to its base type and call the same method ;

7、late binding

All method binding in Java uses late binding unless the method is static or final(private methods are implicitly final)

8、初始化类,先初始化父类,触发父类初始化的方式不是在子类的构造函数中;

转载于:https://my.oschina.net/u/782865/blog/185895

你可能感兴趣的文章
Web前端性能优化之反向代理
查看>>
linux中cron用法
查看>>
Java后台获取Html5拍照的照片并下载的实例方法
查看>>
河马MySQL注入工具v1.1
查看>>
UTR#2 T1
查看>>
Flask-在Flask中跨请求传递数据资源
查看>>
继承c3,网络编程,相互通信
查看>>
django 基础进阶ORM 2
查看>>
AndroidStudio安装流程 以及 使用过程中出现的异常
查看>>
SQL查询语句
查看>>
[转] sql存储过程去锁
查看>>
bzoj1242(弦图判定)
查看>>
谈谈熔断与降级
查看>>
洛谷P4513 小白逛公园
查看>>
类变量、成员变量、实例变量、局部变量、静态变量、全局变量的解释
查看>>
如何构建数据化管理体系
查看>>
python 面向对象高级编程
查看>>
Spring MVC MultiActionController example
查看>>
String类的subString(a,b)方法(基于jdk 1.9)
查看>>
进程池
查看>>