how to get Class of primitive datatypes array . Class.forName(int[]) throws exception
2014-07-28 11:36
537 查看
public static void main(String ar[]) { try { Class byteclass = Class.forName("[B"); System.out.println(byteclass.isArray()); byte[] bb = (byte[])Array.newInstance(byteclass.getComponentType(),4); bb[3] = 8; System.out.println(bb[3]); } catch (Exception e) { e.printStackTrace(); } }
[B for byte array
[I for int array
[F for float array etc works fine
http://www.coderanch.com/t/376256/java/java/Class-primitive-datatypes-array-Class
相关文章推荐
- [jQuery] 如何根据名字来选取checkbox数组 -- How to get the array of checkbox via name
- How to tell RNA-seq library type of strand-specific for RNA-seq data (for reads mapping by Tophat)
- how can i get [5, 7, 13, 2] to go to [5*0, 7*1, 13*2, 2*3] then get the sum of this array.
- How to get max for group by data
- How to get the Diagnostic data and debug file of Sales Order pick release
- How to get the data from a cell when I click on the GridButtonColumn of the same row
- How To Get English Name For East Asian Font Names
- How to get the length of array of strings in C? - Yahoo! Answers
- Java 反射机制 .class .getClass() Class.forName("") .TYPE int void
- How to delete a large number of data in SharePoint for List when refreshing data?
- How to get Login Passwords for application & Data Base instances
- How to bind a GridView to a list of multiple types? NHibernate proxy causing problems with databinding [From stack overflow]
- [笔记] How to get the versionCode and versionName of your app
- How to sort an array of hashes into hashes with multiple values for a key?
- :(23, 7) in class Queen, multiple overloaded alternatives of constructor Queen define default arguments. class Queen private(val name:String,prop:Array[String],private[scala02] val age:Int = 18){
- How To determine DDIC Check Table, Domain and Get Table Field Text Data For Value?
- How To determine DDIC Check Table, Domain and Get Table Field Text Data For Value?
- how to get the Authorization of adobe acrobat 8.0 for free
- How to Get a List of Class Attributes in Python
- How to delete a large number of data in SharePoint for List when refreshing data?