Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Please answer this questions?

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Location
    chennai
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please answer this questions?

    Hi i am rafiq,

    What is the default value of float and double datatype in Java? Its my interview questions could anyone tell me the answer please..


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Please answer this questions?

    Why not answer the question by writing a test program to print out the default value? Or...another way, do an internet search? One of the top hits for the keywords in your post, one which contains the answer:
    Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)
    Sorry to be blunt, but either way it's problem solving - a rather important trait in the world of programming.

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    4
    My Mood
    Mellow
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Please answer this questions?

    public class DataTypeDefaults { 
    	byte byteValue;
    	short shortValue;
    	int intValue;
    	long longValue;
    	float floatValue;
    	double doubleValue;
    	char charValue;
    	boolean booleanValue;
    	String stringValue;
     
    	public static void main(String args[]) { 
    		DataTypeDefaults dtd = new DataTypeDefaults ();
    		System.out.println("byte default value: " + dtd.byteValue);
    		System.out.println("short default value: " + dtd.shortValue);
    		System.out.println("int default value: " + dtd.intValue);
    		System.out.println("long default value: " + dtd.longValue);
    		System.out.println("float default value: " + dtd.floatValue);
    		System.out.println("double default value: " + dtd.doubleValue);
    		System.out.println("char default value: " + dtd.charValue);
    		System.out.println("boolean default value: " + dtd.booleanValue);
    		System.out.println("String default value: " + dtd.stringValue);
    	}
    }
    See more at: Data Types Default Values

    This isn't my work but I found it on the website above and figured it could help you.

Similar Threads

  1. Replies: 3
    Last Post: March 9th, 2013, 07:22 PM
  2. Please help me to answer these questions...
    By Edmond123 in forum Java Theory & Questions
    Replies: 2
    Last Post: December 15th, 2012, 10:27 AM
  3. Please help me to answer these questions..
    By Edmond123 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 15th, 2012, 10:24 AM
  4. List of my Java3D Questions, and Proguard questions
    By Zachary1234 in forum Java SE APIs
    Replies: 0
    Last Post: November 16th, 2012, 09:40 PM
  5. What's ur answer?
    By Tanmaysinha in forum The Cafe
    Replies: 6
    Last Post: October 12th, 2011, 06:26 AM

Tags for this Thread