Java Class forName forName(String name)

Here you can find the source of forName(String name)

Description

for Name

License

LGPL

Declaration

public static Class<?> forName(String name) throws ClassNotFoundException 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static Class<?> forName(String name) throws ClassNotFoundException {
        switch (name) {
        case "byte":
            return byte.class;
        case "short":
            return short.class;
        case "int":
            return int.class;
        case "long":
            return long.class;
        case "float":
            return float.class;
        case "double":
            return double.class;
        case "boolean":
            return boolean.class;
        case "char":
            return char.class;
        default://from w  ww  .  j a  va  2  s .  co m
            return Class.forName(name);
        }
    }
}

Related

  1. forName(String name)
  2. forName(String name)
  3. forName(String name)
  4. forName(String name)
  5. forName(String name)
  6. forName(String name, Class caller)
  7. forName(String origClassName)
  8. forName(String type, Class cast)
  9. forName(String[] classNames)