java
qq_44936836
这个作者很懒,什么都没留下…
展开
-
数组的定义与使用
1.数组是引用类型的数据定义语法:int[] a;赋值:int[] a={1,2,3,4,5};只在初始化的时候使用int[] a=new int[5];(数组中未初始化,元素的值是元素类型的默认值)int[] a=new int[] {1,2,3,4,5};int[] a=null; 只定义了一个数组类型的引用变量,没有数组变量找不到数组2.对数组的操作参考C语言,java中有一...原创 2019-07-20 16:29:56 · 200 阅读 · 0 评论 -
类和对象
类和对象1.什么是类(自行车的设计图)什么是对象(一辆辆的自行车)2.为什么要设计类和对象的机制(面向对象编程)状态 + 行为属性 方法3.面向对象的三大特点:封装|继承|多态4.语法:1)定义类的语法修饰符(modifier)class 类名称{1.属性2.方法/静态方法3.构造方法(必须有,否则编译器会自动补一个)}2)如何定义属性修饰...原创 2019-07-22 17:03:05 · 62 阅读 · 0 评论 -
链表的头插,尾插,头删,尾删和指定位置的插入
public class LinkedArray { public static void main(String[] args){ Node head=null; head=pushFront(head,3); head=pushFront(head,2); head=pushFront(head,1); P...原创 2019-07-26 15:42:24 · 213 阅读 · 0 评论 -
链表反转
public class Reverse { public static void main(String [] args){ Node head = new Node(1); head.next = new Node(2); head.next.next = new Node(3); head.next.next.next ...原创 2019-07-27 08:36:37 · 64 阅读 · 0 评论 -
顺序表的插入和删除
public class Test23{ public static void main(String[] agrs){ MyArrayList list=new MyArrayList(); list.pushBack(1); list.pushBack(2); list.pushBack(3); list.print(); list.pushFront(10); ...原创 2019-07-23 15:45:10 · 321 阅读 · 0 评论 -
链表的深入l拷贝
给定一个链表,每个结点包含一个额外增加的随机指针,该指针可以指向链表中的任何结点或空结点要求返回这个节点的深拷贝。摘要:public class Test27 { public static void main(String[] agrs) { CNode head=null; CNode n1=new CNode(1); CNode...原创 2019-07-27 16:51:35 · 164 阅读 · 0 评论