Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Magazine Discuss the Number Class in the java.lang package & list all its subclasses with appropriate examples.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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


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


Advertisement
View Answers

April 8, 2011 at 3:58 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
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
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   
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
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
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
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
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  
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
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
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
How would you read in and add all this into a list?
How would you read in and add all this into a list?   FYI this is all stacked. 0 " " " " " " " " " " 1 "48" "111" "Dallam" "06" "County" 2 "48" "421" "Sherman" "06" "County" 3 "48" "295" "Lipscomb" "06
 

 

 

DMCA.com