Knowledge (XXG)

Primitive wrapper class in Java

Source 📝

352:
does not mean that wrapper classes are primitive types. It should be understood to be a class that wraps primitive types. Wrapper classes can be used to store the same value as of a primitive type variable but the instances/objects of wrapper classes themselves are
345:, etc., the primitive wrapper classes create instantiated objects and methods that inherit but hide the primitive data types, not like variables that are assigned the data type values. 103:
package. Collection classes are Java API-defined classes that can store objects in a manner similar to how data structures like arrays store primitive data types like
69:, so that these can be used to create instantiated objects with methods in another class or in other classes. The primitive wrapper classes are found in the 490: 415: 476: 448: 677: 462: 333:
Primitive wrapper classes are not the same thing as primitive types. Whereas variables, for example, can be declared in Java as data types
40: 96: 549: 544: 419:
package. These classes are mutable and cannot be used as a replacement for the regular wrapper classes. Instead, they provide
90: 100: 54: 84: 525: 289: 36: 554: 385: 308: 193: 50: 28: 390: 266: 78: 239: 170: 216: 147: 47: 641:
The classes java.math.BigInteger and BigDecimal are not immutable either, although maybe they should have been.
357:. We cannot say that Wrapper classes themselves are Primitive types. They just wrap the primitive types. 654: 66: 529: 420: 629: 119:, etc., but arrays store primitive data types while collections actually store objects. 17: 671: 564: 518: 559: 43: 122:
The primitive wrapper classes and their corresponding primitive types are:
70: 413:
With Java 5.0, additional wrapper classes were introduced in the
405:
are not one of the primitive wrapper classes but are immutable.
426:
The atomic wrapper classes and their corresponding types are:
630:"Mutable and Immutable Objects: Which classes are Immutable?" 329:
The difference between wrapper classes and primitive types
605:, 4th Edition, Mike Murach and Associates, Inc., 2011. 532:" for a description of type parameters in Java). 76:Primitive wrapper classes are used to create an 61:is a wrapper class that encapsulates, hides or 57:in another class that needs those types. So a 8: 618:, Schaum's Outline Series/McGraw Hill, 1998. 82:that needs to represent primitive types in 46:, so that those types can be used to create 597: 595: 593: 430: 423:for addition, increment and assignment. 126: 88:classes (i.e., in the Java API), in the 659:Immutable arbitrary-precision integers. 576: 524:that specifies the type of the object 7: 25: 655:"Java documentation from oracle" 509:classes are subclasses of the 1: 628:David O'Meara (April 2003). 678:Java (programming language) 416:java.util.concurrent.atomic 29:object-oriented programming 694: 65:data types from the eight 603:Murach's Java Programming 555:Java programming language 491:AtomicReference<V> 384:wrapper classes are all 350:Primitive wrapper class 59:primitive wrapper class 18:Primitive wrapper class 587:, Prentice Hall, 1999. 409:Atomic wrapper classes 136:Constructor arguments 616:Programming with Java 585:Introduction to Java 397:The wrapper classes 348:Therefore, the term 67:primitive data types 94:package and in the 517:class accepts the 550:java.lang.reflect 497: 496: 421:atomic operations 324: 323: 97:java.lang.reflect 16:(Redirected from 685: 662: 661: 650: 644: 643: 638: 637: 625: 619: 612: 606: 599: 588: 581: 535: 530:Generics in Java 523: 516: 512: 508: 504: 493: 486: 479: 472: 465: 458: 451: 444: 431: 418: 404: 400: 393: 383: 379: 375: 371: 367: 363: 320: 316: 311: 304: 297: 292: 285: 278: 274: 269: 262: 255: 251: 247: 242: 235: 228: 224: 219: 212: 205: 201: 196: 189: 182: 178: 173: 166: 159: 155: 150: 143: 127: 99: 93: 87: 81: 21: 693: 692: 688: 687: 686: 684: 683: 682: 668: 667: 666: 665: 652: 651: 647: 635: 633: 627: 626: 622: 614:J. R. Hubbard, 613: 609: 600: 591: 583:S. J. Chapman, 582: 578: 573: 541: 533: 521: 515:AtomicReference 514: 510: 506: 502: 489: 484: 475: 470: 461: 456: 447: 442: 414: 411: 402: 398: 389: 381: 377: 373: 369: 365: 361: 331: 318: 314: 307: 302: 295: 288: 283: 276: 272: 265: 260: 253: 249: 245: 238: 233: 226: 222: 215: 210: 203: 199: 192: 187: 180: 176: 169: 164: 157: 153: 146: 141: 95: 89: 83: 77: 23: 22: 15: 12: 11: 5: 691: 689: 681: 680: 670: 669: 664: 663: 645: 620: 607: 589: 575: 574: 572: 569: 568: 567: 562: 557: 552: 547: 540: 537: 519:type parameter 499: 498: 495: 494: 487: 481: 480: 473: 467: 466: 459: 453: 452: 445: 439: 438: 437:Wrapper class 435: 434:Primitive type 410: 407: 330: 327: 326: 325: 322: 321: 312: 305: 299: 298: 293: 286: 280: 279: 270: 263: 257: 256: 243: 236: 230: 229: 220: 213: 207: 206: 197: 190: 184: 183: 174: 167: 161: 160: 151: 144: 138: 137: 134: 131: 130:Primitive type 24: 14: 13: 10: 9: 6: 4: 3: 2: 690: 679: 676: 675: 673: 660: 656: 649: 646: 642: 631: 624: 621: 617: 611: 608: 604: 598: 596: 594: 590: 586: 580: 577: 570: 566: 565:Java compiler 563: 561: 558: 556: 553: 551: 548: 546: 543: 542: 538: 536: 531: 527: 520: 503:AtomicInteger 492: 488: 483: 482: 478: 477:AtomicBoolean 474: 469: 468: 464: 460: 455: 454: 450: 449:AtomicInteger 446: 441: 440: 436: 433: 432: 429: 428: 427: 424: 422: 417: 408: 406: 395: 392: 387: 358: 356: 355:Non-Primitive 351: 346: 344: 340: 336: 328: 313: 310: 306: 301: 300: 294: 291: 287: 282: 281: 271: 268: 264: 259: 258: 244: 241: 237: 232: 231: 221: 218: 214: 209: 208: 198: 195: 191: 186: 185: 175: 172: 168: 163: 162: 152: 149: 145: 140: 139: 135: 133:Wrapper class 132: 129: 128: 125: 124: 123: 120: 118: 114: 110: 106: 102: 98: 92: 86: 80: 74: 72: 68: 64: 60: 56: 52: 49: 45: 42: 38: 34: 33:wrapper class 30: 19: 658: 648: 640: 634:. Retrieved 632:. Java Ranch 623: 615: 610: 602: 584: 579: 513:class. The 500: 425: 412: 396: 359: 354: 349: 347: 342: 338: 334: 332: 121: 116: 112: 108: 104: 75: 62: 58: 41:encapsulates 32: 26: 601:J. Murach, 560:Java syntax 403:BigInteger 636:2012-05-14 571:References 507:AtomicLong 463:AtomicLong 399:BigDecimal 386:subclasses 101:reflection 85:Collection 545:java.lang 526:reference 290:Character 91:java.util 51:instances 672:Category 653:Oracle. 539:See also 528:. (See " 71:Java API 471:boolean 394:class. 388:of the 370:Integer 315:boolean 309:Boolean 303:boolean 194:Integer 158:String 55:methods 511:Number 391:Number 382:Double 380:, and 335:double 319:String 277:String 273:double 267:Double 261:double 254:String 250:double 227:String 204:String 181:String 109:double 79:Object 48:object 378:Float 366:Short 339:short 246:float 240:Float 234:float 177:short 171:Short 165:short 63:wraps 44:types 39:that 37:class 35:is a 505:and 501:The 457:long 401:and 374:Long 362:Byte 360:The 296:char 284:char 223:long 217:Long 211:long 154:byte 148:Byte 142:byte 117:char 113:long 53:and 31:, a 443:int 343:int 317:or 275:or 252:or 225:or 202:or 200:int 188:int 179:or 156:or 115:or 105:int 27:In 674:: 657:. 639:. 592:^ 376:, 372:, 368:, 364:, 341:, 337:, 248:, 111:, 107:, 73:. 534:V 522:V 485:V 20:)

Index

Primitive wrapper class
object-oriented programming
class
encapsulates
types
object
instances
methods
primitive data types
Java API
Object
Collection
java.util
java.lang.reflect
reflection
Byte
Short
Integer
Long
Float
Double
Character
Boolean
subclasses
Number
java.util.concurrent.atomic
atomic operations
AtomicInteger
AtomicLong
AtomicBoolean

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.