![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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 Program to convert string to byte
Use the valueOf() method to convert string to byte. Firstly, let us take a string.
String str = "65";
Now, use the valueOf() method to convert string to byte.
byte res = Byte.valueOf(str);
Let us see the complete example.
Example
public class Demo { public static void main(String[] args) { String str = "65"; System.out.println("String: "+str); byte res = Byte.valueOf(str); System.out.println("Byte: "+res); } }
Output
String: 65 Byte: 65
Advertisements