diff --git a/.project b/.project
new file mode 100644
index 0000000..1090ba2
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+
+
+ JavaBase
+
+
+
+
+
+
+
+
diff --git a/JavaCore/src/com/ddb/javacore/annotation/AnnotDemo.java b/JavaCore/src/com/ddb/javacore/annotation/AnnotDemo.java
index 9af33cc..f1b93ed 100644
--- a/JavaCore/src/com/ddb/javacore/annotation/AnnotDemo.java
+++ b/JavaCore/src/com/ddb/javacore/annotation/AnnotDemo.java
@@ -20,6 +20,8 @@ public static void main(String[] args) throws InstantiationException, IllegalAcc
}
out.println("Cat : " + cat);
+
+
}
}
diff --git a/JavaCore/src/com/ddb/javacore/base/HelloDemo3.java b/JavaCore/src/com/ddb/javacore/base/HelloDemo3.java
index 906b561..3df965b 100644
--- a/JavaCore/src/com/ddb/javacore/base/HelloDemo3.java
+++ b/JavaCore/src/com/ddb/javacore/base/HelloDemo3.java
@@ -5,7 +5,7 @@ public static void main(String[] args) {
args[0] = "123";
args[1] = "456";
System.out.println("Hello World!");
- System.out.println("˭ҵǣ" + args[0] + "ҵǣ" + args[1]);
+ System.out.println("����˭���ҵ������ǣ�" + args[0] + "�ҵ������ǣ�" + args[1]);
System.out.println(args[2]);
}
diff --git a/JavaCore/src/com/ddb/javacore/collection/HashMapDemo.java b/JavaCore/src/com/ddb/javacore/collection/HashMapDemo.java
index 95c82ef..a9ebf8a 100644
--- a/JavaCore/src/com/ddb/javacore/collection/HashMapDemo.java
+++ b/JavaCore/src/com/ddb/javacore/collection/HashMapDemo.java
@@ -29,7 +29,7 @@ public static void main(String[] args) {
out.println("-------------------------------------------------");
for (Entry entry : hMap.entrySet()) {
out.println("entry : " + entry);
- out.println(entry.getKey() + " = " + entry.getValue());
+ out.println(entry.getKey() + "---->" + entry.getValue());
}
diff --git a/JavaCore/src/com/ddb/javacore/collection/ListDemo.java b/JavaCore/src/com/ddb/javacore/collection/ListDemo.java
index d754c25..680747d 100644
--- a/JavaCore/src/com/ddb/javacore/collection/ListDemo.java
+++ b/JavaCore/src/com/ddb/javacore/collection/ListDemo.java
@@ -1,96 +1,102 @@
-package com.ddb.javacore.collection;
-
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import com.ddb.javacore.ood2.Human;
-
-public class ListDemo {
-
- public static void main(String[] args) {
- List strList = new ArrayList();
- List strList2 = new ArrayList();
- List intList = new ArrayList();
- List hmList = new ArrayList();
-
- strList2.add("I");
- strList2.add("am");
- strList2.add("dudongbin");
-
- PrintStream out = System.out;
- //打印list 长度
- out.println("strList.size() : " + strList.size());
- out.println("intList.size() : " + intList.size());
- out.println("hmList.size() : " + hmList.size());
-
- //List 添加元素
- out.println("strList 添加元素");
- strList.add("I ");
- strList.add("love");
- strList.add("China");
- strList.add("!");
- strList.add("!");
- out.println("strList.toString() : " + strList.toString());
-
- //List 删除元素
- out.println("strList 删除元素");
- strList.remove("!");
- out.println("strList.toString() : " + strList.toString());
-
- out.println("strList 删除指定位置元素");
- strList.remove(0);
- out.println("strList.toString() : " + strList.toString());
-
- out.println("strList 添加指定位置元素");
- strList.add(0, "I");
- out.println("strList.toString() : " + strList.toString());
-
- out.println("strList 设置指定位置元素");
- strList.set(3, " very much!");
- out.println("strList.toString() : " + strList.toString());
-
- out.println("strList 获取指定位置元素");
- out.println("strList.get(2) : " + strList.get(2));
-
- out.println("strList 是否为空");
- out.println("strList.isEmpty() : " + strList.isEmpty());
-
- out.println("strList.indexOf('love') : " + strList.indexOf("love"));
-
- out.println("strList.addAll(strList2) : " + strList.addAll(strList2));
- out.println("strList.toString() : " + strList.toString());
- out.println("strList.retainAll(strList2) : " + strList.retainAll(strList2));
- out.println("strList.toString() : " + strList.toString());
-
- out.println("strList.contains('am') : "+strList.contains("am"));
- out.println("strList.containsAll(strList2) : "+strList.containsAll(strList2));
-
- out.println("strList.equals(strList) : "+strList.equals(strList));
-
- out.println("strList.lastIndexOf('I') : "+ strList.lastIndexOf("I"));
-
-
- out.println(strList.subList(1, 4));
- out.println("strList.subList(1, 4) : " + strList.subList(1, 4));
- out.println("strList.subList(1, 4).toString() : " + strList.subList(1, 4).toString());
- //Iterator iterator= strList.iterator();
- while (strList.iterator().hasNext()) {
- Object object = (Object) strList.iterator().next();
- out.println(object);
- }
-
-/* Iterator iterator= strList.iterator();
- while (iterator.hasNext()) {
- Object object = (Object) iterator.next();
- out.println(object);
- }
-*/
- strList.clear();
- out.println("strList.clear() :");
- out.println(strList);
-
- }
-
-}
+package com.ddb.javacore.collection;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.ddb.javacore.ood2.Human;
+
+
+
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.ddb.javacore.ood2.Human;
+
+public class ListDemo {
+
+ public static void main(String[] args) {
+ List strList = new ArrayList();
+ List strList2 = new ArrayList();
+ List intList = new ArrayList();
+ List hmList = new ArrayList();
+
+ strList2.add("I");
+ strList2.add("am");
+ strList2.add("dudongbin");
+
+
+
+ PrintStream out = System.out;
+ //打印list 长度
+ out.println("strList.size() : " + strList.size());
+ out.println("intList.size() : " + intList.size());
+ out.println("hmList.size() : " + hmList.size());
+
+ //List 添加元素
+ out.println("strList 添加元素");
+ strList.add("I ");
+ strList.add("love");
+ strList.add("China");
+ strList.add("!");
+ strList.add("!");
+ out.println("strList.toString() : " + strList.toString());
+
+ //List 删除元素
+ out.println("strList 删除元素");
+ strList.remove("!");
+ out.println("strList.toString() : " + strList.toString());
+
+ out.println("strList 删除指定位置元素");
+ strList.remove(0);
+ out.println("strList.toString() : " + strList.toString());
+
+ out.println("strList 添加指定位置元素");
+ strList.add(0, "I");
+ out.println("strList.toString() : " + strList.toString());
+
+ out.println("strList 设置指定位置元素");
+ strList.set(3, " very much!");
+ out.println("strList.toString() : " + strList.toString());
+
+ out.println("strList 获取指定位置元素");
+ out.println("strList.get(2) : " + strList.get(2));
+
+ out.println("strList 是否为空");
+ out.println("strList.isEmpty() : " + strList.isEmpty());
+
+ out.println("strList.indexOf('love') : " + strList.indexOf("love"));
+
+ out.println("strList.addAll(strList2) : " + strList.addAll(strList2));
+ out.println("strList.toString() : " + strList.toString());
+ out.println("strList.retainAll(strList2) : " + strList.retainAll(strList2));
+ out.println("strList.toString() : " + strList.toString());
+
+ out.println("strList.contains('am') : "+strList.contains("am"));
+ out.println("strList.containsAll(strList2) : "+strList.containsAll(strList2));
+
+ out.println("strList.equals(strList) : "+strList.equals(strList));
+
+ out.println("strList.lastIndexOf('I') : "+ strList.lastIndexOf("I"));
+
+
+ out.println(strList.subList(1, 4));
+ out.println("strList.subList(1, 4) : " + strList.subList(1, 4));
+ out.println("strList.subList(1, 4).toString() : " + strList.subList(1, 4).toString());
+ /* //Iterator iterator= strList.iterator();
+ while (strList.iterator().hasNext()) {
+ Object object = (Object) strList.iterator().next();
+ out.println(object);
+ }*/
+
+ strList.clear();
+ out.println("strList.clear() :");
+ out.println(strList);
+
+ }
+
+}
diff --git a/JavaCore/src/com/ddb/javacore/collection/SetDemo.java b/JavaCore/src/com/ddb/javacore/collection/SetDemo.java
index 0e5cfc1..1693183 100644
--- a/JavaCore/src/com/ddb/javacore/collection/SetDemo.java
+++ b/JavaCore/src/com/ddb/javacore/collection/SetDemo.java
@@ -75,8 +75,8 @@ public static void main(String[] args) {
out.println("intList.removeAll(intList2) :" + intList.removeAll(intList2));
out.println("intList :" + intList);
- /*intList.removeAll(intSet);
- out.println("intList :" + intList);*/
+ intList.removeAll(intSet);
+ out.println("intList :" + intList);
}
}
diff --git a/JavaCore/src/com/ddb/javacore/thread/Account.java b/JavaCore/src/com/ddb/javacore/thread/Account.java
index 51600f3..39fcc2b 100644
--- a/JavaCore/src/com/ddb/javacore/thread/Account.java
+++ b/JavaCore/src/com/ddb/javacore/thread/Account.java
@@ -1,17 +1,13 @@
package com.ddb.javacore.thread;
-import lombok.Getter;
-import lombok.Setter;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
-@Getter
-@Setter
public class Account {
+ private final Lock lock = new ReentrantLock();
private String accountNo;
private double balance;
- // 标识账户中是否已有存款
- private boolean hasMoney = false;
-
public Account() {
}
@@ -22,66 +18,36 @@ public Account(String accountNo, double balance) {
}
/**
- * 取钱
- * @param drawAmount
+ * @return the accountNo
*/
- public synchronized void draw(double drawAmount, int i) {
- if (!hasMoney) {
- // 账户中还没人存钱进去,此时当前线程需要等待阻塞
- try {
- System.out.println(Thread.currentThread().getName() + " 开始要执行wait操作" + " 执行了wait操作" + " -- i=" + i);
- wait();
- System.out.println(Thread.currentThread().getName() + " 执行了wait操作" + " 执行了wait操作" + " -- i=" + i);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- } else {
- // 开始取钱
- System.out.println(Thread.currentThread().getName() + " 取钱:" + drawAmount + " -- i=" + i);
- setBalance(getBalance() - drawAmount);
- System.out.println("取钱后余额为:" + getBalance());
-
- hasMoney = false;
- // 唤醒其他线程
- notifyAll();
- System.out.println(Thread.currentThread().getName() + "-- 取钱 -- 执行完毕" + " -- i=" + i); // 3
- }
+ public String getAccountNo() {
+ return accountNo;
}
-
+
/**
- * 存钱
- * @param depositeAmount
+ * @param accountNo
+ * the accountNo to set
*/
- public synchronized void deposite(double depositeAmount, int i) {
+ public void setAccountNo(String accountNo) {
+ this.accountNo = accountNo;
+ }
+
+ /**
+ * @return the balance
+ */
+ public double getBalance() {
+ lock.lock();
+ return balance;
- if (hasMoney) {
- // 账户中已有人存钱进去,此时当前线程需要等待阻塞
- try {
- System.out.println(Thread.currentThread().getName() + " 开始要执行wait操作" + " -- i=" + i);
- wait();
- // 1
- System.out.println(Thread.currentThread().getName() + " 执行了wait操作" + " -- i=" + i);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- } else {
- // 开始存钱
- System.out.println(Thread.currentThread().getName() + " 存款:" + depositeAmount + " -- i=" + i);
- setBalance(balance + depositeAmount);
- System.out.println("存钱后余额为:" + getBalance());
- hasMoney = true;
- // 唤醒其他线程
- notifyAll();
- // 2
- /*try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }*/
- System.out.println(Thread.currentThread().getName() + "-- 存钱 -- 执行完毕" + " -- i=" + i);
- }
}
-
+ /**
+ * @param balance
+ * the balance to set
+ */
+ public void setBalance(double balance) {
+ this.balance = balance;
+ lock.unlock();
+ }
}
\ No newline at end of file
diff --git a/JavaCore/src/com/ddb/javacore/thread/DepositeMoneyThread.java b/JavaCore/src/com/ddb/javacore/thread/DepositeMoneyThread.java
index 51520c7..265ff39 100644
--- a/JavaCore/src/com/ddb/javacore/thread/DepositeMoneyThread.java
+++ b/JavaCore/src/com/ddb/javacore/thread/DepositeMoneyThread.java
@@ -13,7 +13,7 @@ public DepositeMoneyThread(String threadName, Account account, double amount) {
public void run() {
for (int i = 0; i <= 5; i++) {
- account.deposite(amount, i);
+ account.deposite (amount, i);
}
}
}
\ No newline at end of file
diff --git a/JavaCore/src/com/ddb/javacore/thread/DrawMoneyRunnable.java b/JavaCore/src/com/ddb/javacore/thread/DrawMoneyRunnable.java
index bb90594..393d54c 100644
--- a/JavaCore/src/com/ddb/javacore/thread/DrawMoneyRunnable.java
+++ b/JavaCore/src/com/ddb/javacore/thread/DrawMoneyRunnable.java
@@ -16,7 +16,7 @@ public DrawMoneyRunnable(Account account, double drawAmount) {
this.drawAmount = drawAmount;
}
- public void run() {
+ /*public void run() {
System.out.println(Thread.currentThread().getName());
if (account.getBalance() >= drawAmount) { // 1
System.out.println("取钱成功, 取出钱数为:" + drawAmount);
@@ -24,9 +24,9 @@ public void run() {
account.setBalance(balance);
System.out.println("余额为:" + balance);
}
- }
+ }*/
-/* public synchronized void run() {
+ /*public synchronized void run() {
System.out.println(Thread.currentThread().getName());
if (account.getBalance() >= drawAmount) { // 1
@@ -36,10 +36,10 @@ public void run() {
System.out.println("余额为:" + balance);
}
- }
+ }*/
public void run() {
//public synchronized void run() {
- lock.lock();
+ //lock.lock();
System.out.println(Thread.currentThread().getName());
if (account.getBalance() >= drawAmount) { // 1
System.out.println("取钱成功, 取出钱数为:" + drawAmount);
@@ -47,8 +47,8 @@ public void run() {
account.setBalance(balance);
System.out.println("余额为:" + balance);
}
- lock.unlock();
- }*/
+ //lock.unlock();
+ }
/*public void run() {
synchronized (account) {
diff --git a/JavaCore/src/com/ddb/javacore/thread/ThreadRunableDemo.java b/JavaCore/src/com/ddb/javacore/thread/ThreadRunableDemo.java
index 8a4055a..a821f37 100644
--- a/JavaCore/src/com/ddb/javacore/thread/ThreadRunableDemo.java
+++ b/JavaCore/src/com/ddb/javacore/thread/ThreadRunableDemo.java
@@ -11,6 +11,7 @@ public static void main(String[] args) {
myThread.start();
myRunable.start();
+
}
}
diff --git a/WebCore/WebContent/Html/jsHtml/1.html b/WebCore/WebContent/Html/jsHtml/1.html
new file mode 100644
index 0000000..330fe04
--- /dev/null
+++ b/WebCore/WebContent/Html/jsHtml/1.html
@@ -0,0 +1,24 @@
+
+
+
+
+Insert title here
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/WebCore/WebContent/Html/jsHtml/\350\212\202\347\202\271.html" "b/WebCore/WebContent/Html/jsHtml/\350\212\202\347\202\271.html"
index 89914f3..9249025 100644
--- "a/WebCore/WebContent/Html/jsHtml/\350\212\202\347\202\271.html"
+++ "b/WebCore/WebContent/Html/jsHtml/\350\212\202\347\202\271.html"
@@ -15,7 +15,6 @@
-
- AAA
- CCC
diff --git a/WebCore/WebContent/jQuery/jQueryDemo.html b/WebCore/WebContent/jQuery/jQueryDemo.html
index 718d659..94b4e1f 100644
--- a/WebCore/WebContent/jQuery/jQueryDemo.html
+++ b/WebCore/WebContent/jQuery/jQueryDemo.html
@@ -10,7 +10,7 @@
alert(document.getElementById('txt').value);
} */
function get_text() {
- var jq = $('#txt');
+ //var jq = $('#txt');
var domObj = document.getElementById('txt');
alert($('#txt').val());
}
diff --git a/WebCore/WebContent/jQuery/jQueryDemo2.html b/WebCore/WebContent/jQuery/jQueryDemo2.html
index daea1c3..cdbf903 100644
--- a/WebCore/WebContent/jQuery/jQueryDemo2.html
+++ b/WebCore/WebContent/jQuery/jQueryDemo2.html
@@ -92,8 +92,8 @@
我是隐藏的2
我是隐藏的3
diff --git a/WebCore/WebContent/jQuery/jQueryDemo3.html b/WebCore/WebContent/jQuery/jQueryDemo3.html
index 0935c4a..eb68fda 100644
--- a/WebCore/WebContent/jQuery/jQueryDemo3.html
+++ b/WebCore/WebContent/jQuery/jQueryDemo3.html
@@ -80,7 +80,7 @@
//$('p').after('World
');
$('p').before('World
');
-
+
diff --git a/WebCore/WebContent/jQuery/jQueryDemo6.html b/WebCore/WebContent/jQuery/jQueryDemo6.html
index c5feedc..1a1a339 100644
--- a/WebCore/WebContent/jQuery/jQueryDemo6.html
+++ b/WebCore/WebContent/jQuery/jQueryDemo6.html
@@ -21,7 +21,9 @@
+ style="position: relative; width: 24px; height: 32px;
+ border: 1px solid red;">
+