GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing www.tutorialspoint.com — Java - Byte class with Examples
Selected Reading
Java - Byte class with ExamplesIntroductionThe Java Byte class class wraps a value of primitive type byte in an object. An object of type Byte contains a single field whose type is byte. Class DeclarationFollowing is the declaration for java.lang.Byte class − public final class Byte
extends Number
implements Comparable<Byte>
FieldFollowing are the fields for java.lang.Byte class −
Class constructors
Class methods
Methods inheritedThis class inherits methods from the following classes −
ExampleThe following example shows the usage of Byte class to get byte from a string. package com.tutorialspoint;
public class ByteDemo {
public static void main(String[] args) {
// create a String s and assign value to it
String s = "+120";
// create a Byte object b
Byte b;
// get the value of byte from string
b = Byte.valueOf(s);
// print the value
System.out.println( "Byte value of string " + s + " is " + b );
}
}
Let us compile and run the above program, this will produce the following result − Byte value of string +120 is 120 Advertisements
| ||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |