Download presentation
Presentation is loading. Please wait.
Published byRalph Banks Modified over 9 years ago
1
More than just a song and dance.
2
They are objects that store primitive variable values: Integer – stores an int Double – stores a double Character – stores a char Boolean – stores a boolean
3
Sometimes you want a primitive value stored as an object. This allows you to: Store primitives in complex data structures such as ArrayLists They are pass by reference instead of pass by copy They provide some additional helper methods
4
parseInt(String s) – takes in a String and converts it into the corresponding Integer toHexString(int i) – converts an integer to a hexadecimal String toBinaryString(int i) – converts an integer to a binary String
5
//Declaring variables Integer x = 5; Double y = 6.7; Character z = 'z'; Boolean flag = false; //Using parseInt String numInText = "29274"; Integer a = Integer.parseInt(numInText); //Performing operation Integer b = x + a; System.out.println(b);
6
ArrayList numbers = new ArrayList (); numbers.add(3); numbers.add(5); numbers.add(7); System.out.println(numbers);
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.