Java Byte.parseByte(String s)

Syntax

Byte.parseByte(String s) has the following syntax.

public static byte parseByte(String s)   throws NumberFormatException

Example

In the following code shows how to use Byte.parseByte(String s) method.

The following code uses Byte.parseByte to convert string value to byte value.


public class Main {
  public static void main(String[] args) {
    System.out.println("parse string to byte:"+Byte.parseByte("10"));
  }//  w w  w  .j a  v a  2 s  .com
}

The output:





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable