- package com.felay.test;
- class SuperClass{
- public static String name = "felayman1";
- static {
- System.out.println("superclass static");
- }
- }
- class Subclass extends SuperClass{
- static {
- System.out.println("subclass static");
- }
- }
- public class Test {
- public static void main(String[] args) {
- System.out.println(Subclass.name);
- }
- }
复制代码 |