-
Enhancement
-
Resolution: Not an Issue
-
P3
-
None
-
1.1, 1.1.4
-
x86
-
windows_95, windows_nt
Name: mc57594 Date: 02/10/97
There are classes for the primitive types, but you
can't access them through their names, only indirectly,
for example by having a class with a field of that
type. Try the following example:
public class Test {
public static int i;
public static void main(String[] args) throws Exception {
Class intClass = Class.forName("Test").getField("i").getType();
System.out.println("Int Type: " + intClass);
System.out.println(Class.forName("int"));
}
}
// Results in:
Int Type: int
java.lang.ClassNotFoundException: int
at Test.main(Test.java:8)
company - Rogue Wave Software , email - ###@###.###
======================================================================
- duplicates
-
JDK-4090918 rfe: Class.forName() should take primitive names
-
- Closed
-