Java Reflection class get protection domain

Description

Java Reflection class get protection domain

public class Main {  
  public static void main(String args[]) throws Exception {      
    Class<?> c = Class.forName("java.lang.String");  
    System.out.println("Protection domain: "+c.getProtectionDomain());   
    //w  ww.  j  a v a  2  s  .  c o  m
    c = String.class;
    System.out.println("Protection domain: "+c.getProtectionDomain());   
    
    c = int[].class;
    System.out.println("Protection domain: "+c.getProtectionDomain());   
    
    c = int.class;
    System.out.println("Protection domain: "+c.getProtectionDomain());   
    
    c = Class.class;
    System.out.println("Protection domain: "+c.getProtectionDomain());   
  }  
} 



PreviousNext

Related