Java基础总结(一)

来源:互联网 发布:徐汇网页美工培训课程 编辑:程序博客网 时间:2024/05/02 01:26

前言:

编程过程:为了让计算机知道我们让他干什么,例如计算,给计算机数据并接受数据,数据首先存在内存中,cpu再从内存中取出进行运算。

内存,以字节为单位一片连续的存储空间。1字节Byte为8个2进制位的bit,字节是最小的存储单元。

1,构造函数

int age=8;2个Byte

只要定义了变量,内存就会开辟相应的存储空间(double weight=102.9;)

类是具有同一特性的一类事物的集合

Java的基本类型有:double float int char long short boolean byte 

在造类型的时候,使用构造函数分配空间,用到的是class关键字(要根据实际的需求造不同的类型)

无参构造:public class Student(){}

有参构造:public class Student(int name,string class,int colloge,string remark){

                          this name=name;

                           this class =class;

                           this colloge =colloge;

                           this remark=remark;

                       }

                        

0 0