本篇內(nèi)容主要講解“java查看class文件的方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“java查看class文件的方法”吧!
創(chuàng)新互聯(lián)公司一直通過網(wǎng)站建設(shè)和網(wǎng)站營(yíng)銷幫助企業(yè)獲得更多客戶資源。 以"深度挖掘,量身打造,注重實(shí)效"的一站式服務(wù),以成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、外貿(mào)網(wǎng)站建設(shè)、移動(dòng)互聯(lián)產(chǎn)品、全網(wǎng)整合營(yíng)銷推廣服務(wù)為核心業(yè)務(wù)。十多年網(wǎng)站制作的經(jīng)驗(yàn),使用新網(wǎng)站建設(shè)技術(shù),全新開發(fā)出的標(biāo)準(zhǔn)網(wǎng)站,不但價(jià)格便宜而且實(shí)用、靈活,特別適合中小公司網(wǎng)站制作。網(wǎng)站管理系統(tǒng)簡(jiǎn)單易用,維護(hù)方便,您可以完全操作網(wǎng)站資料,是中小公司快速網(wǎng)站建設(shè)的選擇。
1,首先使用javac編譯文件
2,使用javap工具打開編輯出來的class文件
javap -verbose SyncTestDemo01.class
會(huì)得到如下結(jié)果:
D:\idea_workspace\basic_demo\out\production\basic_demo>javap -verbose SyncTestDemo01.class Classfile /D:/idea_workspace/basic_demo/out/production/basic_demo/SyncTestDemo01.class Last modified 2019-8-25; size 863 bytes MD5 checksum a021136873e306367959a587cdbadbd6 Compiled from "SyncTestDemo01.java" public class SyncTestDemo01 minor version: 0 major version: 52 flags: ACC_PUBLIC, ACC_SUPER Constant pool: #1 = Methodref #12.#28 // java/lang/Object."<init>":()V #2 = Long 5000l #4 = Methodref #29.#30 // java/lang/Thread.sleep:(J)V #5 = Class #31 // java/lang/InterruptedException #6 = Methodref #5.#32 // java/lang/InterruptedException.printStackTrace:()V #7 = Fieldref #33.#34 // java/lang/System.out:Ljava/io/PrintStream; #8 = String #35 // synchronized for method #9 = Methodref #36.#37 // java/io/PrintStream.println:(Ljava/lang/String;)V #10 = String #38 // synchronized for method no method #11 = Class #39 // SyncTestDemo01 #12 = Class #40 // java/lang/Object #13 = Utf8 <init> #14 = Utf8 ()V #15 = Utf8 Code #16 = Utf8 LineNumberTable #17 = Utf8 LocalVariableTable #18 = Utf8 this #19 = Utf8 LSyncTestDemo01; #20 = Utf8 testSync #21 = Utf8 e #22 = Utf8 Ljava/lang/InterruptedException; #23 = Utf8 StackMapTable #24 = Class #31 // java/lang/InterruptedException #25 = Utf8 test01 #26 = Utf8 SourceFile #27 = Utf8 SyncTestDemo01.java #28 = NameAndType #13:#14 // "<init>":()V #29 = Class #41 // java/lang/Thread #30 = NameAndType #42:#43 // sleep:(J)V #31 = Utf8 java/lang/InterruptedException #32 = NameAndType #44:#14 // printStackTrace:()V #33 = Class #45 // java/lang/System #34 = NameAndType #46:#47 // out:Ljava/io/PrintStream; #35 = Utf8 synchronized for method #36 = Class #48 // java/io/PrintStream #37 = NameAndType #49:#50 // println:(Ljava/lang/String;)V #38 = Utf8 synchronized for method no method #39 = Utf8 SyncTestDemo01 #40 = Utf8 java/lang/Object #41 = Utf8 java/lang/Thread #42 = Utf8 sleep #43 = Utf8 (J)V #44 = Utf8 printStackTrace #45 = Utf8 java/lang/System #46 = Utf8 out #47 = Utf8 Ljava/io/PrintStream; #48 = Utf8 java/io/PrintStream #49 = Utf8 println #50 = Utf8 (Ljava/lang/String;)V { public SyncTestDemo01(); descriptor: ()V flags: ACC_PUBLIC Code: stack=1, locals=1, args_size=1 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return LineNumberTable: line 1: 0 LocalVariableTable: Start Length Slot Name Signature 0 5 0 this LSyncTestDemo01; public synchronized void testSync(); descriptor: ()V flags: ACC_PUBLIC, ACC_SYNCHRONIZED Code: stack=2, locals=2, args_size=1 0: ldc2_w #2 // long 5000l 3: invokestatic #4 // Method java/lang/Thread.sleep:(J)V 6: goto 14 9: astore_1 10: aload_1 11: invokevirtual #6 // Method java/lang/InterruptedException.printStackTrace:()V 14: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream; 17: ldc #8 // String synchronized for method 19: invokevirtual #9 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 22: return Exception table: from to target type 0 6 9 Class java/lang/InterruptedException LineNumberTable: line 5: 0 line 8: 6 line 6: 9 line 7: 10 line 9: 14 line 10: 22 LocalVariableTable: Start Length Slot Name Signature 10 4 1 e Ljava/lang/InterruptedException; 0 23 0 this LSyncTestDemo01; StackMapTable: number_of_entries = 2 frame_type = 73 /* same_locals_1_stack_item */ stack = [ class java/lang/InterruptedException ] frame_type = 4 /* same */ public void test01(); descriptor: ()V flags: ACC_PUBLIC Code: stack=2, locals=1, args_size=1 0: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #10 // String synchronized for method no method 5: invokevirtual #9 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: return LineNumberTable: line 13: 0 line 14: 8 LocalVariableTable: Start Length Slot Name Signature 0 9 0 this LSyncTestDemo01; } SourceFile: "SyncTestDemo01.java"
到此,相信大家對(duì)“java查看class文件的方法”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
當(dāng)前題目:java查看class文件的方法
文章來源:http://muchs.cn/article32/ihcjpc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、虛擬主機(jī)、定制網(wǎng)站、做網(wǎng)站、搜索引擎優(yōu)化、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)