摘要: 一、1.this指向 this最常的用法: 在程序中产生二义性之处,应使用this来指明当前对象;普通方法中,this总是指向调用该方法的对象。构造方法中,this总是指向正要初始化的对象。 2. 使用this关键字调用重载的构造方法,避免相同的初始化代码。但只能在构造方法中用,并且必须位于构造方法 阅读全文
posted @ 2020-03-20 19:29 Zh'Blog 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 一、对象和类 1.对象是具体的事物;类是对对象的抽象; 2.类可以看成一对象的模板,对象可以看成该类的一个具体实例。 3.类是用于描述同一类型的对象的一个抽象概念,类中定义了这一类对象所应具有的共同的属性、方法。 public class Stxtu{ int age; int height; St 阅读全文
posted @ 2020-03-20 19:28 Zh'Blog 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 一、方法申明及调用 1.无参数调用 public static void main(String[] args) { nm(); } public static void nm() { System.out.println("sasa"); } 2.有参数调用 public static void 阅读全文
posted @ 2020-03-20 19:26 Zh'Blog 阅读(155) 评论(0) 推荐(0) 编辑
摘要: break可以在switch和循坏语句中使用 continue只能在循坏结构中使用 1.if ……else int a=14; int b=5; if(a>b) { System.out.println("a>b"); }else if(a<b) { System.out.println("a<b" 阅读全文
posted @ 2020-03-20 19:24 Zh'Blog 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 一、数据类型 1.基本数据类型 byte char short int long float double 2.引用数据类型 类 接口 数组 二、运算符 1.算数运算符:+ - * / ++ -- (int a=3; int b=a++; System.out.println("a="+a+"b=" 阅读全文
posted @ 2020-03-20 19:23 Zh'Blog 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 一.对象声明 对象(数组,函数) 1.字面量声明 ovj={ age:10, sex:"男", name:"zh", height:1.3, weight:40, stu:function(a,b){ c=a+b console.log(b) } } console.log(ovj.age) ovj 阅读全文
posted @ 2020-03-15 22:28 Zh'Blog 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 一.函数的声明及调用 1.关键字声明 function 函数名(){} 2.表达式声明 var f=function(){} 3.函数的调用 function f1(a,b){ c=a+b console.log(c) } f1(3,5); 二.函数的返回值 如果函数中没有return,那么函数调用 阅读全文
posted @ 2020-03-15 22:08 Zh'Blog 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 1.数组创建 1.自变量方式创建数组 var a1= 2.构造函数方式创建数组 var a1=new Array(1,2,3,4,"3") 3.数组长度 l=a1.length 2.获取数组元素 遍历数组 1.var b=new Array(1,3,4,5,5,'f') console.log(a1 阅读全文
posted @ 2020-03-15 21:41 Zh'Blog 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 分支结构 1.if语句 var n=90; if(n>60&&n<70){ console.log("及格") }else if(n>70&&n<80){ console.log("良") }else{ console.log("优秀") } 2.switch语句 var jibie="A"; sw 阅读全文
posted @ 2020-03-15 21:24 Zh'Blog 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 一、数据类型 数值:Number 字符串:String 布尔:boolean underfined null object 二、运算符 运算符及优先级 1.()优先级最高 2.一元运算符:++ -- ! 3.算术运算符:+ - * / % 4.关系运算符:> < >= ⇐ 5.相等运算符:== 6. 阅读全文
posted @ 2020-03-15 21:14 Zh'Blog 阅读(261) 评论(0) 推荐(0) 编辑