Êý¾Ý½á¹¹(LinkedListµÄjavaʵÏÖ)
package day10;
import java.util.*;
public class MyLinkedList implements List
{
static class Node
{
public Object data;
public Node next;
public Node(Object data)
{
this.data=data;
}
}
private Node head;
public MyLinkedList()
{
head=new Node(0);
}
public void add(int index, Object element)
{
if(index<(Integer)head.data)
{
Node current;
current=head;
for(int i=0;i<index;i++)
{
current=current.next;
}
Node p=new Node(element);
p.next=current.next;
current.next=p;
head.data=(Integer)head.data+1;
}
else
{
System.out.println("ERROR!");
}
}
@Override
public boolean add(Object e)
{
Node current=head;
while(current.next!=null)
{
current=current.next;
}
Node p=new Node(e);
current.next=p;
head.data=(Integer)head.data+1;
return true;
}
@Override
public boolean addAll(Collection c) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean addAll(int index, Collection c) {
// TODO Auto-generated method stub
return false;
}
@Override
public void clear()
{
head.next=null;
}
@Override
public boolean contains(Object o)
{
Node current=head;
while(current.next!=null)
{
current=current.next;
if(current.data.equals(o))
{
return true;
}
}
return false;
}
@Override
public boolean containsAll(Collection c)
{
// TODO Auto-generated method stub
return false;
}
@Override
public Object get(int index)
{
Node current;
current=head.next;
for(int i=0;i<index;i++)
{
current=current.next;
}
return current.data;
}
@Override
public int indexOf(Object o)
{
int i;
Node current=head;
for(i=0;i<(Integer)head.data;i++)
{
current=current.next;
if(current.data.equals(o))
{
break;
}
}
if(i<(Integer)head.data)
{
return i;
}
return -1;
}
@Override
public boolean isEmpty()
{
if(head.next!=null)
{
return true;
}
return false;
}
@Override
public Iterator iterator()
{
return new Iterator()
{
Nod
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
תÔØ×Ô http://littlefermat.blog.163.com/blog/static/59771167200962810120843/
Enum×÷ΪSunÈ«ÐÂÒý½øµÄÒ»¸ö¹Ø¼ü×Ö£¬¿´ÆðÀ´ºÜÏóÊÇÌØÊâµÄclass, ËüÒ²¿ÉÒÔÓÐ×Ô¼ºµÄ±äÁ¿£¬¿ÉÒÔ¶¨Òå×Ô¼ºµÄ·½·¨£¬¿ÉÒÔʵÏÖÒ»¸ö»òÕ߶à¸ö½Ó¿Ú¡£µ±ÎÒÃÇÔÚÉùÃ÷Ò»¸öenumÀàÐÍʱ£¬ÎÒÃÇÓ¦¸Ã×¢Òâµ½enumÀàÐÍÓÐÈçϵÄһЩÌØÕ÷¡£
1£®Ëü²»ÄÜÓÐpublicµÄ¹¹Ôìº¯Ê ......
1 ±àÒëÃüÁî
¡¡¡¡javac [options] filename.java
¡¡¡¡options->
¡¡¡¡-classpath path ±àÒëʱÐèÒªµÄÀà·¾¶
¡¡¡¡-d directory É趨±àÒëÉú³ÉµÄ.classÎļþÊäÈëµ½ÄÄÒ»¸öĿ¼¡£
¡¡¡¡¹ØÓÚ-dС¼¼ÇÉ : Èç¹û.javaÎļþÖÐʹÓÃÁËpackageÓï¾ä, ÀýÈç package com.test.maths; ¼ÓÉÏ- d . Ñ¡Ïî»á°ïÖúÔÚµ±Ç°Ä¿ ......
JAVA²»ÊÇÍêÃÀµÄ, JAVAµÄ²»×ã³ýÁËÌåÏÖÔÚÔËÐÐËÙ¶ÈÉÏÒª±È´«Í³µÄC++ÂýÐí¶àÖ®Íâ, JavaÎÞ·¨Ö±½Ó·ÃÎʵ½²Ù×÷ϵͳµ×²ã(ÈçϵͳӲ¼þµÈ),Ϊ´ËJavaʹÓÃnative·½·¨À´À©Õ¹Java³ÌÐòµÄ¹¦ÄÜ¡£ ¿ÉÒÔ½«native·½·¨±È×÷Java³ÌÐòͬ£Ã³ÌÐòµÄ½Ó¿Ú£¬ÆäʵÏÖ²½Ö裺
£±¡¢ÔÚJavaÖÐÉùÃ÷native()·½·¨£¬È»ºó±àÒ룻
  ......
ÔÚ»ñÈ¡Îı¾µÄʱºò£¬¾³£Óöµ½Êý¾Ý¸ñʽµÄÎÊÌ⣬ÐèÒªÅжϻòת»»¡£
±¾ÎÄÖ¼ÔÚ½â¾öÈ«½Ç·ûºÅת»»Îª°ë½Ç·ûºÅµÄÎÊÌâ¡£
ÍøÉÏ´óÌåÓÐÁ½ÖÖ·½·¨£º×ª»»±àÂë»òÔòÌæ»»¡£
ÎÒʹÓõÄÊÇת»»±àÂë
1. string checkStr="£±£²£³456";
2. //ÅжÏÊÇ·ñ°üº¬È«½Ç×Ö·û[1]
3. if(checkStr.length() != checkStr.getBytes().length) ......