Initialization & Cleanup笔记
来源:互联网 发布:eve A族女性捏脸数据 编辑:程序博客网 时间:2024/06/05 22:52
public class Flower {
int petalCount = 0;
String s = "initial value";
Flower(int petals) {
petalCount = petals;
print("Constructor w/ int arg only, petalCount= "
+ petalCount);
}
Flower(String ss) {
print("Constructor w/ String arg only, s = " + ss);
s = ss;
}
Flower(String s, int petals) {
this(petals);//这句话只能放在开始位置
//! this(s); // Can’t call two!
this.s = s; // Another use of "this"
print("String & int args");
}
Flower() {
this("hi", 47);
print("default constructor (no args)");
}
void printPetalCount() {
//! this(11); // Not inside non-constructor!
print("petalCount = " + petalCount + " s = "+ s);
}
public static void main(String[] args) {
Flower x = new Flower();
x.printPetalCount();
}
}
=======================================
垃圾收集方法:mark and sweep , stop and copy
=======================================
public class MethodInit{
//int j = g(i); // Illegal forward reference
int i = 3;//f();
int f() { return 11; }
int g(int n) { return n * 10; }
}
=======================================
public class OverloadingVarargs2 {
static void f(float i, Character... args) {
System.out.println("first");
}
static void f(Character... args) {
System.out.print("second");
}
public static void main(String[] args) {
f(1, 'a');
// f('a', 'b'); //可选参数不能精确匹配,'a'会被提升为float
}
}
- Initialization & Cleanup笔记
- Initialization & Cleanup
- Initialization & Cleanup
- Think In Java 笔记1 initialization & Cleanup
- 读书笔记-Thinking in C++-第6章 初始化和清除Initialization& Cleanup
- 处理教材:Initialization & Cleanup of "Thinking in Java"
- Chapter 4:Initialization & Cleanup
- 第四章: Initialization & Cleanup
- 第六章:Initialization & Cleanup
- 6: Initialization and Cleanup
- Day14-44.Initialization & Cleanup
- 【学习笔记】Thinking in java (第三版)第四章 初始化和清除(Initialization & Cleanup)
- thinking in java(III)--initialization and cleanup
- Relearning in JAVA: 5)Initialization & cleanup
- C++编程思想读后感(六):Initialization and Cleanup
- Notes: Initialization and CleanUp(初始化与清理)
- Swift 学习笔记---Initialization
- >看书笔记~
- SET XACT_ABORT { ON | OFF }SQL Server 是否自动回滚到当前事务
- 帮忙~请问SQL2005能不能卸载的啊?
- 索爱机型接口定义
- C#操纵大量数据表的一种方法菜鸟经验谈
- Team Foundation Server 维护手记
- Initialization & Cleanup笔记
- javascript 如何正确使用getElementById,getElementsByName(), and getElementsByTagName()
- 实现在oracle中发邮件功能
- 论坛各种问题总结--(随时更新)
- html 标签解嵌套
- SVM
- 画龙点睛的第二职业
- 读GUI设计禁忌2.0有感
- IronPython 2.6 Beta 2