摘要:静态代码块:static {初始化静态变量的语句};当类被载入时,静态代码块被执行,且只执行一次。单态设计模式:所谓单体设计模式,就是保证类在虚拟机中只保存一个实例。首先,要实现只有一个实例,必须保证类外不能构造类的实例,即用private修饰。有由于static静态量能保证只被实例化一次。且加final修饰,即声明为:private static final (变量类型)变量名 = 变量初始化/类初始化方法。然后建立public方法,供外界调用:public (type)getinstance (){return ;}实现单态。nested classes (嵌套类):所谓嵌套类即内部类,如
阅读全文
摘要:1 Java基本数据类型 2 public class Main { 3 public static void main(String[] args) { 4 /** 5 * 输出java基本数据类型的数值范围 6 */ System.out.println("byte : " + Byte.MIN_VALUE + " to " + Byte.MAX_VALUE);//short的范围8 7 System.out.println("short : " + Short.MIN_VALUE + " to " 8 + S
阅读全文
摘要:顺序循环队列头文件:SQUEUE.H 1 #ifndef __SQUEUE_H__ 2 #define __SQUEUE_H__ 3 4 #define TRUE 1 5 #define FALSE 0 6 #define ERROR -1 7 #define MAXSIZE 100 8 #define DataType int 9 10 typedef struct {11 DataType data[MAXSIZE];12 int front, rear;13 }SQueue, *SQueueP;14 15 //循环队列创建16 SQueueP QueueCreate() {17 SQu.
阅读全文
摘要:链栈头文件:LINKSTACK.H 1 /* 2 说明:本头文件包含链式栈的基本操作 3 */ 4 #ifndef __LINKSTACK_H__ 5 #define __LINKSTACK_H__ 6 7 #include <stdlib.h> 8 9 #define TRUE 110 #define FALSE 011 #define ERROR -112 #define DataType int13 14 typedef struct node {15 DataType data;16 struct node *next;17 }stackNode, *stackNodeP;
阅读全文
摘要:顺序栈头文件:SQSTACK.H 1 /* 2 说明:头文件包含栈的基本操作 3 */ 4 #ifndef __SQSTACK_H__ 5 #define __SQSTACK_H__ 6 7 #include <stdlib.h> 8 9 #define TRUE 110 #define FALSE 011 #define ERROR -112 #define MAXSIZE 6413 #define DataType int14 15 typedef struct {16 DataType data[MAXSIZE];17 int top;18 }SqStack, *SqStac
阅读全文
摘要:链表综合操作头文件:LIST.H 1 #ifndef __LIST_H__ 2 #define __LIST_H__ 3 /* 4 说明:此处的链表含有头结点H, 且头结点的数据域Data放置节点总数(不包括头结点) 5 */ 6 #include <stdio.h> 7 #include <stdlib.h> 8 9 #define DataType int 10 #define TRUE 1 11 #define FALSE 0 12 #define ERROR -1 13 14 typedef struct node{ 15 DataType Data; 16 s
阅读全文