- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create an Integer object in Java
To create an Integer object in Java is quite easy. Let us learn about the following two ways for this purpose.
Method1
Example
public class Demo { public static void main(String []args) { Integer obj = new Integer("199"); System.out.println(obj); } }
Output
199
Method2 −Now let us see the second way
Example
Public class Demo { public static void main(String []args) { Integer obj = new Integer(99); System.out.println(obj); } }
Output
99
Advertisements