• Post Reply Bookmark Topic Watch Topic
  • New Topic

can any one please help me to sort out this problems  RSS feed

 
gagan narula
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
1> can any one please tell me why we have premitive type of data in java rather we already have wrapper for all those data type.

2> if i wan to store the value whose size is grater than 64 bytes i mean greater than the size of evry data type which is available in java can any one please tel me how to store that value and which data type i have to use in that case.

3> how to wire code dynamically in class.

Bye
Gagan
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Probably because of efficiency reasons. Primitive data types are what sometimes are called "value types" - a variable of a primitive type directly contains the value. Besides primitive types, you have reference types, which don't contain the value directly, but are just pointers to objects on the heap. I agree however that it is not really necessary that the distinction between primitive types and reference types is expressed so explicitly in the language as it is in Java - in other programming languages (Ruby for example) everything is an object, and the Ruby interpreter hides the way that values are stored behind the scenes.

2. You mean 64 bits instead of 64 bytes. If you need to work with numbers that don't fit into a 64-bit long, you can use the classes java.math.BigInteger or java.math.BigDecimal.

3. I don't know what you mean by this. You can load classes dynamically and discover what methods a class has with the reflection API; see the documentation of the package java.lang.reflect.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!