文章列表
第一次
class Person{
public static final int a=new Random().nextInt(40);
static{
System.out.println("类被初始化");
}
}
public class Test01 {
public static void main(String[] args) {
System.out.println(Person.a);
}
}
运行结果
类被初始化
31
第二次
class Person{
public static final int a=4/2;
...
1.已有对象扩充自己的对象
var object = new Object();
object.name="guohao";
object.sayName = function(name) {
this.name = name;
alert(this.name);
}
缺点:一次只能创建出一个对象,不能产生创建对象的一个模板
2.工厂方式创建对象
function createObject(name,password) {
var object = new Object();
object.name ...
[size=large]1.对象冒充
function Father(name) {
this.name = name;
this.sayName = function() {
alert(this.name);
}
}
function Child(name,age) {
this.method=Father;
this.method(name);
delete this.method;
this.age = age;
this.sayAge = function() {
alert(this. ...
正则表达式是一个查询的字符串,它包含一般的字符和一些特殊的字符,特殊字符可以扩展查找字符串的能力,正则表达式在查找和替换字符串的作用不可忽视,它能很好提高工作效率。
EditPlus的查找,替换,文件中查找支持以下的正则表达式:
表达式 说明
/t 制表符.
/n 新行.
. 匹配任意字符.
| 匹配表达式左边和右边的字符. 例如, "ab|bc" 匹配 "ab" 或者 "bc".
[] 匹配列表之中的任何单个字符. 例如, "[ab]" 匹配 "a" 或者 ...