Tag Archives: Java-Library

strictfp keyword in java

strictfp is a keyword in java used for restricting floating-point calculations and ensuring same result on every platform while performing operations in the floating-point variable. Floating point calculations are platform dependent i.e. different output(floating-point values) is achieved when a class file is run on different platforms(16/32/64 bit processors). To solve this types of issue, strictfp… Read More »

Character Class in Java

Java provides a wrapper class Character in java.lang package. An object of type Character contains a single field, whose type is char. Creating a Character object : Character ch = new Character(‘a’); The above statement creates a Character object which contain ‘a’ of type char. There is only one constructor in Character class which expect… Read More »

Java.io.DataInputStream class in Java | Set 2

Java.io.DataInputStream class in Java | Set 1 More Methods: byte readByte() : Reads and returns one input byte. Syntax:public final byte readByte() throws IOException Returns: the next byte of this input stream as a signed 8-bit byte. Throws: EOFException IOException float readFloat() : Reads four input bytes and returns a float value. Syntax:public final float… Read More »

java.lang.Character class – methods | Set 2

java.lang.Character class – methods | Set 1 Following methods of Character class are discussed here : toUpperCase() : java.lang.toUpperCase(char arg) method converts given character in argument to its Upper case based on Unicode values. Syntax : public static char toUpperCase(char arg) Parameters : arg : character to be converted to Upper case Return : Upper… Read More »

java.math class and its methods | Set 1

Math class provides mathematical functions to preform basic numeric operations such as exponential, logarithm, square root, and trigonometric functions. cosh, sin, tan, abs, bitLength, multiply and many more. Implementations of the functions of Math class do not return bit-for-bit same results. Hence, perform better implementations. Class Declaration public final class Math extends Object This set… Read More »

Math class methods in Java with Examples | Set 2

java.math class and its methods | Set 1 java.math class methods discussed in this article : abs() : java.math.abs() method returns the absolute value of any type of argument passed. This method can handle all the data types. Special Case : Result is positive zero, if the argument is positive zero or negative zero. Result… Read More »

java.lang.Character class methods | Set 1

lang.Character class wraps the value of a primitive data type – char to an object of datatype char and this object contains single field having the data type – char. This class provides no. of methods regarding character manipulations like convert them from lowercase to uppercase. Character class is based on Unicode Standards to provide… Read More »

util.date class methods in Java with Examples

Following are some important date class methods : .toString() : java.util.Date.tostring() method is a java.util.Date class method.It displays the Current date and time. Here Date object is converted to a string and represented as: day mon dd hh:mm:ss zz yyyy day : day of the week mon : month dd : day of the month… Read More »

File handling in Java using FileWriter and FileReader

Java FileWriter and FileReader classes are used to write and read data from text files (they are Character Stream classes). It is recommended not to use the FileInputStream and FileOutputStream classes if you have to read and write any textual information as these are Byte stream classes. Image Source : http://www3.ntu.edu.sg/home/ehchua/programming/java/j5b_io.html FileWriter FileWriter is useful… Read More »

java.util.Currency methods with example

This class represents currency. Here, currency is identified by their ISO 4217 currency codes. The purpose of ISO 4217 is to establish internationally recognized codes for the representation of currencies. Currencies can be represented in the code in two ways: a three-letter alphabetic code and a three-digit numeric code. util.Currency methods in Java / /… Read More »