SakthiPrabhu.g
Doubt on Data Types
2 Answer(s)      6 years and 6 months ago
Posted in : Java Beginners
Advertisement
View Answers

December 22, 2008 at 1:01 AM


import java.io.*;
class Ft
{
public static void main(String args[])
{
float f=4.5f; //ERROR ON FLOAT DECLARATION
System.out.println("Float Value.........:"+f);
}
}

you need to put f after 4.5 it is a float value na....so you need to put it in java.


December 22, 2008 at 4:13 AM


If you want to declare a decimal value in Java, it will be considered as double datatype by default. So to specifically mention a float datatype value you should add character 'f' or 'F' at the end of the value.

In your case it can be declared as float f=4.5f; or float f=4.5F;









Related Tutorials/Questions & Answers:
Doubt on Data Types - Java Beginners
Doubt on Data Types  Hi Friend doubt on DataTypes... How should i declare n Assign value to the Float variable; Can u Please COMPILE this Program...Explain in detail
data types
data types  Write a short note on data types of Java.   Please visit the following link: Java datatypes
Advertisements
Numeric Data Types
Numeric Data Types  Compare numeric data types of java with corresponding data types in C
JavaScript Data Types
JavaScript Data Types  What are JavaScript Data Types
Data types in a table
Data types in a table  hii, What are the data types allowed in a table?   hello,, These are the data types in table:- VARCHAR2, CHAR, NUMBER, RAW, DATE, LONG and LONG RAW.   hello,, These are the data
Hibernate Data types
This section lists Hibernate data types
Are arrays primitive data types?
Are arrays primitive data types?   Hi, Are arrays primitive data types? thanks   Hi, In Java, Arrays are objects. Identifier are some... as primitive data type
Declaring Data Types in Java
Declaring Data Types in Java  What is the best way of declaring data types in Java?   http://www.roseindia.net/java/master-java/java-data... named 'byteident' which primitive data type is byte."); System.out.println
Data Types in Java 7
In this section we will discuss Java 7 Data Types
demonstrating understanding of data types
demonstrating understanding of data types  Design and implement a Java program that will gather a userÔ??s first name, middle initial, lastname, age in years, and 3 lucky numbers. The program should output the following based
java parsing of data types
java parsing of data types  Why its not works? char ch; String s=* ch=Character.parseChar(s) program: char op; DataInputStream dis=new DataInputStream(System.in); System.out.print("Enter operator (+,-,*,/,%): "); op
Object with different data types
Object with different data types  Hello, I need to build a "patient" object that can contain String "name", String "ID", double "weight" and Date "birthDate". Then that object is referenced to the linked list. I know how to use
Java Data Types
Java Data Types      ... more primitive data types which are supported by Java language programming.... Following are the eight primitive data types: int It is a 32-bit signed two's
size of different basic data types
size of different basic data types   Write a simple program to find the size of different basic data types in java
What are the data types allowed in a table?
What are the data types allowed in a table?  What are the data types allowed in a table?   Hi, The data types allowed in a table are as follows- binary Bigint bit Char datetime decimal Float
Primitive Data Types
In this section we will discuss about Primitive Data Types in Java 7
Reference Data Types
In this section we will discuss about Reference Data Types in Java 7
PHP Data Types
Data Types in PHP:  In programming language there are two types of data: atomic data and composite data, atomic data are those which can not broken further and composite data are just the opposite and it can be broken further
Data types in Oracle 9i - SQL
Data types in Oracle 9i  Cn anyone tell me the difference between timestamp wih time zone and timestamp with local timezone datatypes in oracle 9i.  Hi Friend, On Using TIMESTAMP WITH TIME ZONE, oracle store timezone
doubt this
doubt this  what is the use of "this" and "super" keyword
Reference Data Types
Reference Data Types      ...;Reference Data Types Lets have a discussion about Reference Data Types in brief In Java a reference data type is a variable that can
Primitive Data Types
Primitive Data Types In java, all the variables needs to be declared first... Data Types.... The value assigned to a variable determines its data type, on which the legal
DOUBT ?
DOUBT ?  in c++ member function of a class must be public
Java Data Types
Java Data Types      ... and then to be used. Java support eight types of primitive data types. Primitive data types are the data types already defined in Java. Following are the eight
Doubt
Doubt  how to submit the details and how to go the next page after submitting.please clarify my doubt I don't know how to submit details
Mapping MySQL Data Types in Java
Mapping MySQL Data Types in Java       Data types of MySQL and Java programming language... using MySQL data types and a application using Java data types. We need to provide
Doubt
User request form  how to submit the details and how to go the next page after submitting.please clarify my doubt I don't know how to submit details.   1)page1.html: <html> <form type=get action="page2.html
Doubt
How to load page  how to submit the details and how to go the next page after submitting.please clarify my doubt I don't know how to submit details.   1)page1.html: <html> <form type=get action="page2.html
Doubt
Submit and process form  how to submit the details and how to go the next page after submitting.please clarify my doubt I don't know how to submit details.   1)page1.html: <html> <form type=get action
Doubt
load next page after submitting  how to submit the details and how to go the next page after submitting.please clarify my doubt I don't know how to submit details.   1)page1.html: <html> <form type=get action
doubt
data type like int,float which are not object 2)It does not support operator