- 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
Java Integer byteValue() method
The byteValue() method returns the value of this Integer as a byte.
Following is an example to implement the byteValue() method in Java −
Example
public class Main { public static void main(String[] args) { Integer val = new Integer(10); byte res = val.byteValue(); System.out.println("Value = " + res); } }
Output
Value = 10
Let us see another example −
Example
import java.util.*; public class Main { public static void main(String[] args) { Byte b = new Byte("10"); byte res = b.byteValue(); System.out.println("Byte = " + b ); System.out.println("Primitive byte = "+ res); } }
Output
Byte = 80 Primitive byte = 80
Advertisements