List of usage examples for java.lang Short Short
@Deprecated(since = "9") public Short(String s) throws NumberFormatException
From source file:Main.java
public static void main(String[] args) { short s = 10; Short sObj = new Short(s); System.out.println(sObj);/* w w w . j a va2 s . com*/ }
From source file:Main.java
public static void main(String[] args) { short s = 10; Short sObj = new Short(s); String str = sObj.toString(); System.out.println(str);/* w w w.ja v a 2s.c o m*/ }
From source file:MainClass.java
public static void main(String[] args) { short s = -1800; Short s2 = new Short(s); System.out.println(s2.shortValue()); }
From source file:Main.java
public static void main(String[] args) { short s = 101; Short shortObject2 = new Short(s); System.out.println(shortObject2); }
From source file:Main.java
public static void main(String[] args) { short s = 10; Short sObj1 = new Short(s); Short sObj2 = new Short("10"); System.out.println(sObj1);/*from w w w .j a v a2 s . co m*/ System.out.println(sObj2); }
From source file:Main.java
public static void main(String[] args) { short sval = 50; Short shortValue = new Short(sval); System.out.println("Value is = " + shortValue.toString()); }
From source file:Main.java
public static void main(String[] args) { short shortNum1 = 150; Short ShortObj1 = new Short(shortNum1); int hcode = ShortObj1.hashCode(); System.out.println("Hashcode for this Short ShortObj1 = " + hcode); }
From source file:Main.java
public static void main(String[] args) { Short sObj = new Short("10"); byte b = sObj.byteValue(); System.out.println(b);//from w w w . java 2 s. c om short s = sObj.shortValue(); System.out.println(s); int i = sObj.intValue(); System.out.println(i); float f = sObj.floatValue(); System.out.println(f); double d = sObj.doubleValue(); System.out.println(d); long l = sObj.longValue(); System.out.println(l); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Boolean refBoolean = new Boolean(true); boolean bool = refBoolean.booleanValue(); Byte refByte = new Byte((byte) 123); byte b = refByte.byteValue(); Character refChar = new Character('x'); char c = refChar.charValue(); Short refShort = new Short((short) 123); short s = refShort.shortValue(); Integer refInt = new Integer(123); int i = refInt.intValue(); Long refLong = new Long(123L); long l = refLong.longValue(); Float refFloat = new Float(12.3F); float f = refFloat.floatValue(); Double refDouble = new Double(12.3D); double d = refDouble.doubleValue(); }
From source file:Main.java
public static void main(String[] args) throws Exception { short s = 56; FileOutputStream out = new FileOutputStream("test.txt"); ObjectOutputStream oout = new ObjectOutputStream(out); // write something in the file oout.writeShort(s);/* w w w.j a va 2 s. co m*/ oout.writeShort(new Short("1")); oout.flush(); oout.close(); // create an ObjectInputStream for the file we created before ObjectInputStream ois = new ObjectInputStream(new FileInputStream("test.txt")); // read and print a short System.out.println(ois.readShort()); // read and print a short System.out.println(ois.readShort()); ois.close(); }