Java by API/java.lang/Byte — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 14:40, 31 мая 2010
Содержание
Byte: byteValue()
public class Main {
public static void main(String[] args) {
byte by = (byte) "A";
Byte by2 = new Byte(by);
System.out.println(by2.byteValue());
}
}
Byte: doubleValue()
public class Main {
public static void main(String[] args) {
Byte bObj = new Byte("10");
byte b = bObj.byteValue();
System.out.println(b);
short s = bObj.shortValue();
System.out.println(s);
int i = bObj.intValue();
System.out.println(i);
float f = bObj.floatValue();
System.out.println(f);
double d = bObj.doubleValue();
System.out.println(d);
long l = bObj.longValue();
System.out.println(l);
}
}
Byte: floatValue()
public class Main {
public static void main(String[] args) {
Byte bObj = new Byte("10");
byte b = bObj.byteValue();
System.out.println(b);
short s = bObj.shortValue();
System.out.println(s);
int i = bObj.intValue();
System.out.println(i);
float f = bObj.floatValue();
System.out.println(f);
double d = bObj.doubleValue();
System.out.println(d);
long l = bObj.longValue();
System.out.println(l);
}
}
Byte: intValue()
public class Main {
public static void main(String[] args) {
Byte bObj = new Byte("10");
byte b = bObj.byteValue();
System.out.println(b);
short s = bObj.shortValue();
System.out.println(s);
int i = bObj.intValue();
System.out.println(i);
float f = bObj.floatValue();
System.out.println(f);
double d = bObj.doubleValue();
System.out.println(d);
long l = bObj.longValue();
System.out.println(l);
}
}
Byte: longValue()
public class Main {
public static void main(String[] args) {
Byte bObj = new Byte("10");
byte b = bObj.byteValue();
System.out.println(b);
short s = bObj.shortValue();
System.out.println(s);
int i = bObj.intValue();
System.out.println(i);
float f = bObj.floatValue();
System.out.println(f);
double d = bObj.doubleValue();
System.out.println(d);
long l = bObj.longValue();
System.out.println(l);
}
}
Byte.MAX_VALUE
public class Main {
public static void main(String[] args) {
System.out.println(Byte.MIN_VALUE);
System.out.println(Byte.MAX_VALUE);
}
}
/*
-128
127
*/
Byte.MIN_VALUE
public class Main {
public static void main(String[] args) {
System.out.println(Byte.MIN_VALUE);
System.out.println(Byte.MAX_VALUE);
}
}
/*
-128
127
*/
Byte: shortValue()
public class Main {
public static void main(String[] args) {
Byte bObj = new Byte("10");
byte b = bObj.byteValue();
System.out.println(b);
short s = bObj.shortValue();
System.out.println(s);
int i = bObj.intValue();
System.out.println(i);
float f = bObj.floatValue();
System.out.println(f);
double d = bObj.doubleValue();
System.out.println(d);
long l = bObj.longValue();
System.out.println(l);
}
}
Byte: toString(byte b)
public class Main {
public static void main(String[] args) {
byte b = 65;
System.out.println(Byte.toString(b));
}
}
Byte: valueOf(String stringValue)
/*
* Output:
true
c
12
2
13245
12341234
11234.123
4.321324123412341E10
*/
public class MainClass {
public static void main(String args[]) {
Boolean bool = Boolean.valueOf("true");
Character c = new Character("c");
Byte b = Byte.valueOf("12");
Short s = Short.valueOf("2");
Integer i = Integer.valueOf("13245");
Long l = Long.valueOf("12341234");
Float f = Float.valueOf("11234.1234");
Double d = Double.valueOf("43213241234.123412341234");
System.out.println(bool);
System.out.println(c);
System.out.println(b);
System.out.println(s);
System.out.println(i);
System.out.println(l);
System.out.println(f);
System.out.println(d);
}
}
new Byte(byte value)
public class Main {
public static void main(String[] args) {
byte i = 10;
Byte bObj = new Byte(i);
System.out.println(bObj);
}
}
new Byte(String s)
public class Main {
public static void main(String[] args) {
Byte bObj = new Byte("10");
String str = bObj.toString();
System.out.println(str);
}
}