Home > Java > javaTutorial > Analyze the instance structure of Java Class files

Analyze the instance structure of Java Class files

WBOY
Release: 2023-04-26 14:37:07
forward
727 people have browsed it

Structural Description

1. Class: external class, member (member internal class, static internal class), local internal class, anonymous internal class

2. interface: interface

3, []: array

4, enum: enumeration

5, annotation: annotation@interface

6, primitive type : Basic data type

7, void: No return value

Instance

@Test
public void test3(){
    Class<Object> c1 = Object.class;
    Class<Comparable> c2 = Comparable.class;
    Class<String[]> c3 = String[].class;
    Class<int[][]> c4 = int[][].class;
    Class<ElementType> c5 = ElementType.class;
    Class<Override> c6 = Override.class;
    Class<Integer> c7 = int.class;
    Class<Void> c8 = void.class;
    Class<Class> c9 = Class.class;
 
    int[] i1 = new int[10];
    int[] i2 = new int[100];
    Class<? extends int[]> c10 = i1.getClass();
    Class<? extends int[]> c11 = i2.getClass();
    // 只要数组的元素类型与维度一样,就是同一个Class
    System.out.println(c10 == c11);//true
}
Copy after login

The above is the detailed content of Analyze the instance structure of Java Class files. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template