一、创建测试类

package com.example.jvm.bytecode;

public class MyTest2 {

    String str = "Welcome";

    private  int x = 5;

    public static  Integer in = 10;

    public static void main(String[] args) {
MyTest2 myTest2 = new MyTest2(); myTest2.setX(8); in = 20;
} public void setX(int x){
this.x = x;
}
}

 

反编译MyTest2.class文件

D:\workspace\study\ jvm_demo\build\classes\java\main\com\example\jvm\bytecode>javap -verbose MyTest2.class
Classfile /D:/workspace/study/ jvm_demo/build/classes/java/main/com/example/jvm/bytecode/MyTest2.class
Last modified 2019-6-26; size 847 bytes
MD5 checksum d8f82e3e7255d9a738591c52d3a5417b
Compiled from "MyTest2.java"
public class com.example.jvm.bytecode.MyTest2
SourceFile: "MyTest2.java"
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #10.#34 // java/lang/Object."<init>":()V
#2 = String #35 // Welcome
#3 = Fieldref #5.#36 // com/example/jvm/bytecode/MyTest2.str:Ljava/lang/String;
#4 = Fieldref #5.#37 // com/example/jvm/bytecode/MyTest2.x:I
#5 = Class #38 // com/example/jvm/bytecode/MyTest2
#6 = Methodref #5.#34 // com/example/jvm/bytecode/MyTest2."<init>":()V
#7 = Methodref #5.#39 // com/example/jvm/bytecode/MyTest2.setX:(I)V
#8 = Methodref #40.#41 // java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
#9 = Fieldref #5.#42 // com/example/jvm/bytecode/MyTest2.in:Ljava/lang/Integer;
#10 = Class #43 // java/lang/Object
#11 = Utf8 str
#12 = Utf8 Ljava/lang/String;
#13 = Utf8 x
#14 = Utf8 I
#15 = Utf8 in
#16 = Utf8 Ljava/lang/Integer;
#17 = Utf8 <init>
#18 = Utf8 ()V
#19 = Utf8 Code
#20 = Utf8 LineNumberTable
#21 = Utf8 LocalVariableTable
#22 = Utf8 this
#23 = Utf8 Lcom/example/jvm/bytecode/MyTest2;
#24 = Utf8 main
#25 = Utf8 ([Ljava/lang/String;)V
#26 = Utf8 args
#27 = Utf8 [Ljava/lang/String;
#28 = Utf8 myTest2
#29 = Utf8 setX
#30 = Utf8 (I)V
#31 = Utf8 <clinit>
#32 = Utf8 SourceFile
#33 = Utf8 MyTest2.java
#34 = NameAndType #17:#18 // "<init>":()V
#35 = Utf8 Welcome
#36 = NameAndType #11:#12 // str:Ljava/lang/String;
#37 = NameAndType #13:#14 // x:I
#38 = Utf8 com/example/jvm/bytecode/MyTest2
#39 = NameAndType #29:#30 // setX:(I)V
#40 = Class #44 // java/lang/Integer
#41 = NameAndType #45:#46 // valueOf:(I)Ljava/lang/Integer;
#42 = NameAndType #15:#16 // in:Ljava/lang/Integer;
#43 = Utf8 java/lang/Object
#44 = Utf8 java/lang/Integer
#45 = Utf8 valueOf
#46 = Utf8 (I)Ljava/lang/Integer;
{
java.lang.String str;
flags: public static java.lang.Integer in;
flags: ACC_PUBLIC, ACC_STATIC public com.example.jvm.bytecode.MyTest2();
flags: ACC_PUBLIC
Code:
stack=2, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: aload_0
5: ldc #2 // String Welcome
7: putfield #3 // Field str:Ljava/lang/String;
10: aload_0
11: iconst_5
12: putfield #4 // Field x:I
15: return
LineNumberTable:
line 3: 0
line 5: 4
line 7: 10
LocalVariableTable:
Start Length Slot Name Signature
0 16 0 this Lcom/example/jvm/bytecode/MyTest2; public static void main(java.lang.String[]);
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=2, args_size=1
0: new #5 // class com/example/jvm/bytecode/MyTest2
3: dup
4: invokespecial #6 // Method "<init>":()V
7: astore_1
8: aload_1
9: bipush 8
11: invokevirtual #7 // Method setX:(I)V
14: bipush 20
16: invokestatic #8 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
19: putstatic #9 // Field in:Ljava/lang/Integer;
22: return
LineNumberTable:
line 12: 0
line 14: 8
line 16: 14
line 17: 22
LocalVariableTable:
Start Length Slot Name Signature
0 23 0 args [Ljava/lang/String;
8 15 1 myTest2 Lcom/example/jvm/bytecode/MyTest2; public void setX(int);
flags: ACC_PUBLIC
Code:
stack=2, locals=2, args_size=2
0: aload_0
1: iload_1
2: putfield #4 // Field x:I
5: return
LineNumberTable:
line 20: 0
line 21: 5
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 this Lcom/example/jvm/bytecode/MyTest2;
0 6 1 x I static {};
flags: ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: bipush 10
2: invokestatic #8 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
5: putstatic #9 // Field in:Ljava/lang/Integer;
8: return
LineNumberTable:
line 9: 0
}

  

二、将setX改为private

此时需要使用javap -verbose -p  MyTest2.class才能显示私有方法

D:\workspace\study\ jvm_demo\build\classes\java\main\com\example\jvm\bytecode>javap -verbose -p  MyTest2.class
Classfile /D:/workspace/study/ jvm_demo/build/classes/java/main/com/example/jvm/bytecode/MyTest2.class
Last modified 2019-6-27; size 847 bytes
MD5 checksum f9ed848bb768588b932c395b40c509a8
Compiled from "MyTest2.java"
public class com.example.jvm.bytecode.MyTest2
SourceFile: "MyTest2.java"
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #10.#34 // java/lang/Object."<init>":()V
#2 = String #35 // Welcome
#3 = Fieldref #5.#36 // com/example/jvm/bytecode/MyTest2.str:Ljava/lang/String;
#4 = Fieldref #5.#37 // com/example/jvm/bytecode/MyTest2.x:I
#5 = Class #38 // com/example/jvm/bytecode/MyTest2
#6 = Methodref #5.#34 // com/example/jvm/bytecode/MyTest2."<init>":()V
#7 = Methodref #5.#39 // com/example/jvm/bytecode/MyTest2.setX:(I)V
#8 = Methodref #40.#41 // java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
#9 = Fieldref #5.#42 // com/example/jvm/bytecode/MyTest2.in:Ljava/lang/Integer;
#10 = Class #43 // java/lang/Object
#11 = Utf8 str
#12 = Utf8 Ljava/lang/String;
#13 = Utf8 x
#14 = Utf8 I
#15 = Utf8 in
#16 = Utf8 Ljava/lang/Integer;
#17 = Utf8 <init>
#18 = Utf8 ()V
#19 = Utf8 Code
#20 = Utf8 LineNumberTable
#21 = Utf8 LocalVariableTable
#22 = Utf8 this
#23 = Utf8 Lcom/example/jvm/bytecode/MyTest2;
#24 = Utf8 main
#25 = Utf8 ([Ljava/lang/String;)V
#26 = Utf8 args
#27 = Utf8 [Ljava/lang/String;
#28 = Utf8 myTest2
#29 = Utf8 setX
#30 = Utf8 (I)V
#31 = Utf8 <clinit>
#32 = Utf8 SourceFile
#33 = Utf8 MyTest2.java
#34 = NameAndType #17:#18 // "<init>":()V
#35 = Utf8 Welcome
#36 = NameAndType #11:#12 // str:Ljava/lang/String;
#37 = NameAndType #13:#14 // x:I
#38 = Utf8 com/example/jvm/bytecode/MyTest2
#39 = NameAndType #29:#30 // setX:(I)V
#40 = Class #44 // java/lang/Integer
#41 = NameAndType #45:#46 // valueOf:(I)Ljava/lang/Integer;
#42 = NameAndType #15:#16 // in:Ljava/lang/Integer;
#43 = Utf8 java/lang/Object
#44 = Utf8 java/lang/Integer
#45 = Utf8 valueOf
#46 = Utf8 (I)Ljava/lang/Integer;
{
java.lang.String str;
flags: private int x;
flags: ACC_PRIVATE public static java.lang.Integer in;
flags: ACC_PUBLIC, ACC_STATIC public com.example.jvm.bytecode.MyTest2();
flags: ACC_PUBLIC
Code:
stack=2, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: aload_0
5: ldc #2 // String Welcome
7: putfield #3 // Field str:Ljava/lang/String;
10: aload_0
11: iconst_5
12: putfield #4 // Field x:I
15: return
LineNumberTable:
line 3: 0
line 5: 4
line 7: 10
LocalVariableTable:
Start Length Slot Name Signature
0 16 0 this Lcom/example/jvm/bytecode/MyTest2; public static void main(java.lang.String[]);
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=2, args_size=1
0: new #5 // class com/example/jvm/bytecode/MyTest2
3: dup
4: invokespecial #6 // Method "<init>":()V
7: astore_1
8: aload_1
9: bipush 8
11: invokespecial #7 // Method setX:(I)V
14: bipush 20
16: invokestatic #8 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
19: putstatic #9 // Field in:Ljava/lang/Integer;
22: return
LineNumberTable:
line 12: 0
line 14: 8
line 16: 14
line 17: 22
LocalVariableTable:
Start Length Slot Name Signature
0 23 0 args [Ljava/lang/String;
8 15 1 myTest2 Lcom/example/jvm/bytecode/MyTest2; private void setX(int);
flags: ACC_PRIVATE
Code:
stack=2, locals=2, args_size=2
0: aload_0
1: iload_1
2: putfield #4 // Field x:I
5: return
LineNumberTable:
line 20: 0
line 21: 5
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 this Lcom/example/jvm/bytecode/MyTest2;
0 6 1 x I static {};
flags: ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: bipush 10
2: invokestatic #8 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
5: putstatic #9 // Field in:Ljava/lang/Integer;
8: return
LineNumberTable:
line 9: 0
}

三、现在将setX方法增加synchronized 修饰符

private synchronized void setX(int x)
反编译后无synchronized和有synchronized的区别如下图:


四、在类中增加test方法,方法里面使用了synchronize

    private void test(String str){
synchronized (obj){
System.out.println("hello world");
}
}

  反编译后如下:

 private void test(java.lang.String);
flags: ACC_PRIVATE
Code:
stack=2, locals=4, args_size=2
0: aload_0
1: getfield #6 // Field obj:Ljava/lang/Object;
4: dup
5: astore_2
6: monitorenter
7: getstatic #12 // Field java/lang/System.out:Ljava/io/PrintStream;
10: ldc #13 // String hello world
12: invokevirtual #14 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
15: aload_2
16: monitorexit
17: goto 25
20: astore_3
21: aload_2
22: monitorexit
23: aload_3
24: athrow
25: return
Exception table:
from to target type
7 17 20 any
20 23 20 any
LineNumberTable:
line 26: 0
line 27: 7
line 28: 15
line 29: 25
LocalVariableTable:
Start Length Slot Name Signature
0 26 0 this Lcom/example/jvm/bytecode/MyTest2;
0 26 1 str Ljava/lang/String;
StackMapTable: number_of_entries = 2
frame_type = 255 /* full_frame */
offset_delta = 20
locals = [ class com/example/jvm/bytecode/MyTest2, class java/lang/String, class java/lang/Object ]
stack = [ class java/lang/Throwable ]
frame_type = 250 /* chop */
offset_delta = 4

  出现了6: monitorenter和22: monitorexit

给当前MyTest2类所对应的class对象上锁

private synchronized static void test2(){

}

给当前对象上锁

private synchronized void setX(int x){
this.x = x;
}

五、字节码文件分析

最终需要分析的java文件

package com.example.jvm.bytecode;

public class MyTest2 {

    String str = "Welcome";

    private  int x = 5;

    public static  Integer in = 10;

    public static void main(String[] args) {
MyTest2 myTest2 = new MyTest2(); myTest2.setX(8); in = 20;
} private synchronized void setX(int x){
this.x = x;
} private void test(String str){
synchronized (str){
System.out.println("hello world");
}
} private synchronized static void test2(){ }
}

  然后反编译MyTest2.class

Classfile /D:/workspace/study/ jvm_demo/build/classes/java/main/com/example/jvm/bytecode/MyTest2.class
Last modified 2019-6-27; size 1265 bytes
MD5 checksum 1ca3fedabb74af431cc850f3f87b7763
Compiled from "MyTest2.java"
public class com.example.jvm.bytecode.MyTest2
SourceFile: "MyTest2.java"
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #13.#45 // java/lang/Object."<init>":()V
#2 = String #46 // Welcome
#3 = Fieldref #5.#47 // com/example/jvm/bytecode/MyTest2.str:Ljava/lang/String;
#4 = Fieldref #5.#48 // com/example/jvm/bytecode/MyTest2.x:I
#5 = Class #49 // com/example/jvm/bytecode/MyTest2
#6 = Methodref #5.#45 // com/example/jvm/bytecode/MyTest2."<init>":()V
#7 = Methodref #5.#50 // com/example/jvm/bytecode/MyTest2.setX:(I)V
#8 = Methodref #51.#52 // java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
#9 = Fieldref #5.#53 // com/example/jvm/bytecode/MyTest2.in:Ljava/lang/Integer;
#10 = Fieldref #54.#55 // java/lang/System.out:Ljava/io/PrintStream;
#11 = String #56 // hello world
#12 = Methodref #57.#58 // java/io/PrintStream.println:(Ljava/lang/String;)V
#13 = Class #59 // java/lang/Object
#14 = Utf8 str
#15 = Utf8 Ljava/lang/String;
#16 = Utf8 x
#17 = Utf8 I
#18 = Utf8 in
#19 = Utf8 Ljava/lang/Integer;
#20 = Utf8 <init>
#21 = Utf8 ()V
#22 = Utf8 Code
#23 = Utf8 LineNumberTable
#24 = Utf8 LocalVariableTable
#25 = Utf8 this
#26 = Utf8 Lcom/example/jvm/bytecode/MyTest2;
#27 = Utf8 main
#28 = Utf8 ([Ljava/lang/String;)V
#29 = Utf8 args
#30 = Utf8 [Ljava/lang/String;
#31 = Utf8 myTest2
#32 = Utf8 setX
#33 = Utf8 (I)V
#34 = Utf8 test
#35 = Utf8 (Ljava/lang/String;)V
#36 = Utf8 StackMapTable
#37 = Class #49 // com/example/jvm/bytecode/MyTest2
#38 = Class #60 // java/lang/String
#39 = Class #59 // java/lang/Object
#40 = Class #61 // java/lang/Throwable
#41 = Utf8 test2
#42 = Utf8 <clinit>
#43 = Utf8 SourceFile
#44 = Utf8 MyTest2.java
#45 = NameAndType #20:#21 // "<init>":()V
#46 = Utf8 Welcome
#47 = NameAndType #14:#15 // str:Ljava/lang/String;
#48 = NameAndType #16:#17 // x:I
#49 = Utf8 com/example/jvm/bytecode/MyTest2
#50 = NameAndType #32:#33 // setX:(I)V
#51 = Class #62 // java/lang/Integer
#52 = NameAndType #63:#64 // valueOf:(I)Ljava/lang/Integer;
#53 = NameAndType #18:#19 // in:Ljava/lang/Integer;
#54 = Class #65 // java/lang/System
#55 = NameAndType #66:#67 // out:Ljava/io/PrintStream;
#56 = Utf8 hello world
#57 = Class #68 // java/io/PrintStream
#58 = NameAndType #69:#35 // println:(Ljava/lang/String;)V
#59 = Utf8 java/lang/Object
#60 = Utf8 java/lang/String
#61 = Utf8 java/lang/Throwable
#62 = Utf8 java/lang/Integer
#63 = Utf8 valueOf
#64 = Utf8 (I)Ljava/lang/Integer;
#65 = Utf8 java/lang/System
#66 = Utf8 out
#67 = Utf8 Ljava/io/PrintStream;
#68 = Utf8 java/io/PrintStream
#69 = Utf8 println
{
java.lang.String str;
flags: private int x;
flags: ACC_PRIVATE public static java.lang.Integer in;
flags: ACC_PUBLIC, ACC_STATIC public com.example.jvm.bytecode.MyTest2();
flags: ACC_PUBLIC
Code:
stack=2, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: aload_0
5: ldc #2 // String Welcome
7: putfield #3 // Field str:Ljava/lang/String;
10: aload_0
11: iconst_5
12: putfield #4 // Field x:I
15: return
LineNumberTable:
line 3: 0
line 5: 4
line 7: 10
LocalVariableTable:
Start Length Slot Name Signature
0 16 0 this Lcom/example/jvm/bytecode/MyTest2; public static void main(java.lang.String[]);
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=2, args_size=1
0: new #5 // class com/example/jvm/bytecode/MyTest2
3: dup
4: invokespecial #6 // Method "<init>":()V
7: astore_1
8: aload_1
9: bipush 8
11: invokespecial #7 // Method setX:(I)V
14: bipush 20
16: invokestatic #8 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
19: putstatic #9 // Field in:Ljava/lang/Integer;
22: return
LineNumberTable:
line 12: 0
line 14: 8
line 16: 14
line 17: 22
LocalVariableTable:
Start Length Slot Name Signature
0 23 0 args [Ljava/lang/String;
8 15 1 myTest2 Lcom/example/jvm/bytecode/MyTest2; private synchronized void setX(int);
flags: ACC_PRIVATE, ACC_SYNCHRONIZED
Code:
stack=2, locals=2, args_size=2
0: aload_0
1: iload_1
2: putfield #4 // Field x:I
5: return
LineNumberTable:
line 20: 0
line 21: 5
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 this Lcom/example/jvm/bytecode/MyTest2;
0 6 1 x I private void test(java.lang.String);
flags: ACC_PRIVATE
Code:
stack=2, locals=4, args_size=2
0: aload_1
1: dup
2: astore_2
3: monitorenter
4: getstatic #10 // Field java/lang/System.out:Ljava/io/PrintStream;
7: ldc #11 // String hello world
9: invokevirtual #12 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
12: aload_2
13: monitorexit
14: goto 22
17: astore_3
18: aload_2
19: monitorexit
20: aload_3
21: athrow
22: return
Exception table:
from to target type
4 14 17 any
17 20 17 any
LineNumberTable:
line 24: 0
line 25: 4
line 26: 12
line 27: 22
LocalVariableTable:
Start Length Slot Name Signature
0 23 0 this Lcom/example/jvm/bytecode/MyTest2;
0 23 1 str Ljava/lang/String;
StackMapTable: number_of_entries = 2
frame_type = 255 /* full_frame */
offset_delta = 17
locals = [ class com/example/jvm/bytecode/MyTest2, class java/lang/String, class java/lang/Object ]
stack = [ class java/lang/Throwable ]
frame_type = 250 /* chop */
offset_delta = 4 private static synchronized void test2();
flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNCHRONIZED
Code:
stack=0, locals=0, args_size=0
0: return
LineNumberTable:
line 31: 0 static {};
flags: ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: bipush 10
2: invokestatic #8 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
5: putstatic #9 // Field in:Ljava/lang/Integer;
8: return
LineNumberTable:
line 9: 0
}

然后打开WinHex打开MyTest2.class 文件

JVM synchronized关键字所生成的字节码的更多相关文章

  1. synchronized关键字所生成的字节码详细分析

    在之前已经将如下这样的源文件对应的字节码文件完整的分析完了,如下: 这次再来写一个内容稍丰富一点的类,准备再来从头至尾的来分析一下,对其字节码的理解进一步巩固,如下: 然后用javap -verbos ...

  2. eclipse中的项目无法在build/classes目录下生成.class字节码

    转载 原文链接:https://www.cnblogs.com/iceblow/p/6648715.html 1.首先确定project->Build Automatically是否勾选上:  ...

  3. 【synchronized锁】通过synchronized锁 反编译查看字节码指令分析synchronized关键字修饰方法与代码块的区别

    前提: 首先要铺垫几个前置的知识: Java中的锁如sychronize锁是对象锁,Java对象头中具有标识位,当对象锁升级为重量级锁时,重量级锁的标识位会指向监视器monitor, 而每个Java对 ...

  4. 【JVM】模板解释器--如何根据字节码生成汇编码?

    1.背景 仅针对JVM的模板解释器: 如何根据opcode和寻址模式,将bytecode生成汇编码. 本文的示例中所使用的字节码和汇编码,请参见上篇博文:按值传递还是按引用? 2.寻址模式 本文不打算 ...

  5. JVM(三)类加载与字节码技术

    1.类文件结构 首先获得.class字节码文件 方法: 在文本文档里写入java代码(文件名与类名一致),将文件类型改为.java 在文件对应目录下运行cmd,执行javac XXX.java 以下是 ...

  6. 深入了解java虚拟机(JVM) 第十三章 虚拟机字节码执行引擎

    一.概述 执行引擎是java虚拟机最核心的组成部件之一.虚拟机的执行引擎由自己实现,所以可以自行定制指令集与执行引擎的结构体系,并且能够执行那些不被硬件直接支持的指令集格式.所有的Java虚拟机的执行 ...

  7. java动态代理——jvm指令集基本概念和方法字节码结构的进一步探究及proxy源码分析四

    前文地址 https://www.cnblogs.com/tera/p/13336627.html 本系列文章主要是博主在学习spring aop的过程中了解到其使用了java动态代理,本着究根问底的 ...

  8. javap生成的字节码

    https://www.zhihu.com/question/49470442/answer/135812845http://blog.csdn.net/tzs_1041218129

  9. JVM 字节码(四)静态方法、构造代码、this 以及 synchronized 关键字

    JVM 字节码(四)静态方法.构造代码.this 以及 synchronized 关键字 一.静态代码 public class ByteCodeStatic { private static fin ...

随机推荐

  1. c# 计算目录的大小

  2. CentOS7清理老旧内核

    CentOS7如果是一步步内核升级上来的将会面临一个问题(一般安装了图形化界面的系统常见),由于内核增多/boot/的容量减少,导致启动变慢.这时就需要清理老旧内核,释放/boot/空间. 使用una ...

  3. vmware联网解决方案:host-only共享上网

    一.需求说明 vmware通过桥接的方式可以上外网,但是虚拟机的IP地址必须和物理网卡在同一网段,上网环境不同虚拟机必须跟着换ip地址很麻烦,所以最好是采用host-only方式上网. 特别是做架构实 ...

  4. SecurityProtocolType 枚举

    地址:https://docs.microsoft.com/zh-cn/dotnet/api/system.net.securityprotocoltype?redirectedfrom=MSDN&a ...

  5. 判断 List map set 是否为空

    //如果object为null,则设置为defaultValue ObjectUtils.defaultIfNull(object, defaultValue); //判断集合是否为null List ...

  6. sqlite3中给表添加列

    1.修改表名为临时表 ALTER TABLE {tableName} RENAME TO TempOldTable; 2.创建新表,跟原来的表名一致 CREATE TABLE {tableName} ...

  7. java oracle的2种分页方法

    java oracle的2种分页方法 一物理分页: <!-- 分页查询所有的博客信息 --> <select id="findBlogs" resultType= ...

  8. Post Office Problem

    Description There are n houses on a line. Given an array A and A[i] represents the position of i-th  ...

  9. JQuery通过click事件获取当前点击对象的id,name,value属性等

    $(".test").click(function () { var val=$(this).attr("id"); })

  10. 【概率论】5-7:Gama分布(The Gamma Distributions Part II)

    title: [概率论]5-7:Gama分布(The Gamma Distributions Part II) categories: - Mathematic - Probability keywo ...