Share on Google+Share on Google+

nayani prasangika
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.
1 Answer(s)      6 years ago
Posted in : Java Beginners

Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.

Ads

View Answers

April 8, 2011 at 3:57 PM


Subclasses of Number class are:

 BigDecimal
 BigInteger
 Byte
 Double
 Float
 Integer
 Long
 Short

Example:

import java.util.*;
class  ScannerExample
{
    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        System.out.print("Enter Number: ");
        String st=input.next();
        int intnum=Integer.parseInt(st);
        double doublenum=Double.parseDouble(st);
        double floatnum=Float.parseFloat(st);
        double longnum=Long.parseLong(st);
        double shortnum=Short.parseShort(st);

        System.out.println(intnum);
        System.out.println(doublenum);
        System.out.println(floatnum);
        System.out.println(longnum);
        System.out.println(shortnum);
    }
}

BigInteger Examples

BigDecimal Examples










Related Tutorials/Questions & Answers:
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.  Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.  Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples
Advertisements
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.  Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.
Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.  Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples
Discuss the Number Class in the java.lang package
Discuss the Number Class in the java.lang package   Discuss the Number Class in the java.lang package
subclasses an imported class - Java Beginners
subclasses an imported class  Sir, Pls help me to write: Program to illustrate subclasses an imported class Thanks
Java Exception Class Hierarchy Diagram
class. The class Exception and its subclasses are defined in such a way... extends the Throwable class. All errors and exception classes are the subclasses... in this class are inherited from its parent class i.e. java.lang.Throwable
How do Unzip a directory and all its contents using ZipEntry class in java.
How do Unzip a directory and all its contents using ZipEntry class in java. In this Example, We will discuss the use isDirectory method of ZipEntry class.... The ZipEntry class is available in java.util.zip package. The isDirectory method
Examples of Wrapper Class
Examples of Wrapper Class In this page we are giving you the links... in the java.lang package. These classes provides object methods for the following... value through add(Object) method. 3.  Append all elements through
Class in Java
; In this section, we will discuss about java classes and its structure. First of all learn:  what is a class in java and then move on to its... a member of the class available to all classes in the same package and all
Convert Decimal To Character
;  This is the simple program of java.lang package. In this example, we are going to convert decimal number to its corresponding character. Code Description: Here, define class named ?DecimalToChar? for java component
PHP list class methods
Function get_class_methods gives the all methods names of the given class. It takes input as class name and returns the array of the methods name PHP LIst Class Methods Example <?php class myclass{ function aa
class with in its own objects?
class with in its own objects?  Is it a good idea to declare a class with in its own objects
Java Util Examples List
package of JDK. All the examples are with free source code. It includes many examples that demonstrate the syntax and example code of java util package... Java Util Examples List - Util Tutorials   
List control class
List control class  Hi... What Class does all list base controls extend? and implement? please give me the name of these classes..... Tnanks   Ans: All list based control extend the ListBase class and implement
PHP list all variables
PHP all declared and environment variables can be listed get_defined_vars() method returns all the variables in the form of array. The array returned is handles by the class ArrayObject class. Example of PHP List of all
list file number - Java Beginners
list file number  sir you still haven't understand my problem. i have to list out only the number of files in a given directory,your solution still give number of (files+directories) in given directory. are jfilechooser provide
Java Conversion
will learn to convert decimal number into binary. The java.lang package provides... into a hexadecimal number. The package java.lang provides the functionality... number into an integer. The java.lang package provides the functionality to convert
class odject in list
class odject in list  I have three class. In first class i have get and set methods, in second class i have a list of objects of first class then after main class i want to read the objects values but it will shows only
How to find list of all index in Neo4j?
How to find list of all index in Neo4j?  Hi, I have database in Neo4j and I want to find the list of all the indexes in it. How to get the list...: :schema This command will list all the indexes. Here is one example: Indexes
Java Path Class
Java Path Class In this section we will discuss all the aspect of Path class of Java. In Java, Path class is added from the SE 7 release. Java 7 has added the java.nio.file package (new file IO). Prior to JDK7/JRE7 many of the methods
which class is super class to all classes
which class is super class to all classes  in java which class is super class to all classes   Object is the super class for all user defined and predefined class.   java.lang.Object is the supper class of all
What is the base class of all classes?
What is the base class of all classes?  Hi, What is the base class of all classes? thanks   Hi, The base class is nothing but the Abstract class of Java programming. We uses the syntax for base class of all
List all directories on FTP Server
In this section you will learn how to list all the directories on FTP server using java
PHP list all files in directory
Using the readdir() and opendir() function all files of the directory can be listed. readdir() function uses the file handler of the readdir() function. It then returns the filename of the directory. Example <?php  
PHP list all files
All files, directories of the given directory can be listed. function readdir() takes input as the directory handle. Then readdir() returns the name of all the files and directories. PHP List All Files Example <?php  
JAVA Code for Getting List of Directories and its SubDirectories from FTP server
JAVA Code for Getting List of Directories and its SubDirectories from FTP server  **Hi. I am trying to get list of all directories and sub directories and its files from "FTP" and want to show in Jtree but i am unable to do
write a program to demonstrate wrapper class and its methods......
write a program to demonstrate wrapper class and its methods......  write a program to demonstrate wrapper class and its methods
How to list all drives available in the system
How to list all drives available in the system In this section, you will learn how to list out all the drives available in the system.  Description of code: To get the list of drives, we have called the method listRoots() of File
why java file save as its class name
why java file save as its class name  hi,this is subbareddy vajrala.my doubt is why java files save as its class names
Tutorials   
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads