class Short intValue () método : Aquí, vamos a aprender sobre el método intValue () de class Short con su sintaxis y su ejemplo.
class Short intValue () método
- método
- intValue () está disponible en java.lang class.
- intValue () método se utiliza para class el valor denotado por este objeto package convertir al tipo return (por colada).
- intValue () método es un método no Short, es accesible sólo con el objeto int y si tratamos de acceder al método con el nombre static entonces obtendrá un error.
- método intValue () hace no class una excepción en el momento de la conversión de class a throw.
Sintaxis:
public int intValue();
Parámetro (s):
- No acepta cualquier parámetro.
short valor:
El tipo int de este método es Return , devuelve un valor convertido (de tipo return a class) representado por este objeto int.
Ejemplo:
// Java program to demonstrate the example
// of intValue() method of Short class
public class IntValueOfShortClass {
public static void main(String[] args) {
// Variables initialization
short value1 = 100;
short value2 = 200;
// It returns short value denoted by this Short ob1 object
// and converted to a int by calling ob1.intValue()
Short ob1 = new Short(value1);
// Display ob1 result
System.out.println("ob1.intValue(): " + ob1.intValue());
// It returns short value denoted by this Short ob2 object
// and converted to a int by calling ob2.intValue()
Short ob2 = new Short(value2);
// Display ob2 result
System.out.println("ob2.intValue(): " + ob2.intValue());
}
}
salida
ob1.intValue(): 100
ob2.intValue(): 200