Skip to content

Tag Archives: Java-Data Types

There are two types of data types namely primitive datatype/fundamental and non-primitive/derived datatype. The primitive data type is defined as local sets or default set… Read More
Given a Float value in Java, the task is to convert this float value to string type. Examples: Input: 1.0 Output: "1.0" Input: 3.14 Output:… Read More
Given a Short value in Java, the task is to convert this short value to string type. Examples: Input: 1 Output: "1" Input: 3 Output:… Read More
Given a Double value in Java, the task is to convert this double value to string type. Examples: Input: 1.0 Output: "1.0" Input: 3.14 Output:… Read More
Given a Byte value in Java, the task is to convert this byte value to string type. Examples: Input: 1 Output: "1" Input: 3 Output:… Read More
Given a String “str” in Java, the task is to convert this string to float type. Examples: Input: str = "1.0" Output: 1.0 Input: str… Read More
Given a String “str” in Java, the task is to convert this string to short type. Examples: Input: str = "1" Output: 1 Input: str… Read More
Given a String “str” in Java, the task is to convert this string to byte type. Examples: Input: str = "1" Output: 1 Input: str… Read More
Given a double value val, the task is to set its precision value to a specific decimal places.  Examples:   Input: val = 1 Output: 1.0000… Read More
Prerequisite – Autoboxing and unboxing in Java 1)What is the output of the following program? class Main {     public static void main(String[] args)     {         Double… Read More
Java comprises 5 conditional blocks namely – if, switch, while, for and try. In all these blocks, if the specified condition is true, the code… Read More
Enum in Java is a data type that contains fixed set of constants. A Java enum type is a special kind of Java class. An… Read More
Compacting many infinite real numbers into a finite number of bits requires an approximate representation. Most programs store the result of integer computations 32 or… Read More
NumberFormat is an abstract base class for all number formats. This class provides the interface for formatting and parsing numbers. NumberFormat also provides methods for… Read More
Consider the following two codes in Java: // This program prints true class Geeksforgeeks {   public static void main(String args[]) {     float f = 5.25f;… Read More