一、类和对象 1, JavaScript对象分为三类:本地对象,内置对象,宿主对象。 本地对象有15种:Object Function Array String Number Boolean Date RegExp Error EvalError RangeError Rrefenc...
分类:
编程语言 时间:
2015-03-31 21:41:12
阅读次数:
116
Date日期对象日期对象可以储存任意一个日期,可以精确到毫秒。varmyDate=newDate();//得到的是当前时间document.write(myDate);//结果:TueMar31201514:59:01GMT+0800(中国标准时间)Date中对日期和时间常用的方法:其中的getYear()得到的值是年份-1900,setYear()同理。String..
分类:
Web程序 时间:
2015-03-31 20:26:14
阅读次数:
187
类中域为基本类型可以被自动初始化为0,对象引用会被初始化为null。
初始化对象引用的方法
{
1.在定义对象的地方。
2.在类的构造器中
3.在正要使用对象之前(惰性初始化)
4.实例初始化
}
class Soap {
private String s;
Soap() {
print("Soap()");
s = "Constructed";...
分类:
其他好文 时间:
2015-03-31 20:09:00
阅读次数:
115
namespace 烧开水循环跳转{ class Program { static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Green; Console.Clear(); while (true) { st....
分类:
其他好文 时间:
2015-03-31 20:01:40
阅读次数:
107
{ class Program { static void Main(string[] args) { while (true) { int sum = 0; for (int i = 1; i 49 && a <= 100) { sum = sum + 10; Console.WriteLine....
分类:
其他好文 时间:
2015-03-31 20:00:56
阅读次数:
121
class Program { static void Main(string[] args) { while (true) { int a, b; int s = 0; Console.WriteLine("请输入第一个数:"); a = Convert.ToInt32(Console.Read....
分类:
其他好文 时间:
2015-03-31 20:00:27
阅读次数:
123
调用类中变量的写法实际上应该是:对象名.变量名 1.this代表调用该成员的对象,通常对象名被省略,即省略了this.但是在有同名变量参与时不可省略。如下面的情形: public void setNum(String num){ this.num = num;} 2.当在同一个类中的一个构造函数中调...
分类:
编程语言 时间:
2015-03-31 19:57:47
阅读次数:
141
5、运算符:变量的意义就在于可以进行运算,运算需要用运算符来表示,分为以下几种 1 class test 2 { 3 public static void main(String[] args) 4 { 5 //赋值运算符 =(赋值) +=,-=,*=,/= 6 ...
分类:
编程语言 时间:
2015-03-31 19:55:19
阅读次数:
159
static void Main(string[] args) { while (true) { int ct=0,xt=0,yt=1,zt=1,m; Console.WriteLine("请输入月数:"); m = Convert.ToInt32(Console.ReadLine()); for....
分类:
其他好文 时间:
2015-03-31 19:53:47
阅读次数:
121
namespace 纸张的厚度循环{ class Program { static void Main(string[] args) { while (true) { double a; Console.WriteLine("请输入纸张的厚度:(毫米)"); a =Convert.ToDouble(...
分类:
其他好文 时间:
2015-03-31 19:49:49
阅读次数:
83