Found 35502 Articles for Programming

Overflow of DataTypes in Java

Samual Sam
Updated on 26-Jun-2020 10:05:01

751 Views

Overflow occurs when the given value is more than the maximum prescribed size of a data type. The overflow condition can result to an error or now the implementation of the programming language handles it on its own.To display overflow of datatypes, I have taken an example of float datatype. Float data type is a single-precision 32-bit IEEE 754 floating point.The range of a float datatype is −approximately ±3.40282347E+38FThe following program display overflow of datatypes in Java.Example Live Demopublic class Demo {    public static void main(String[] args) {       System.out.println("Displaying Overflow... ");       float val1 = ... Read More

Display the minimum and maximum value of primitive data types in Java

karthikeya Boyini
Updated on 26-Jun-2020 10:05:50

3K+ Views

Every data type in Java has a minimum as well as maximum range, for example, for Float.Min = 1.4E-45 Max = 3.4028235E38Let’s say for Float, if the value extends the maximum range displayed above, it leads to Overflow.However, if the value is less than the minimum range displayed above, it leads to Underflow.The following is the Java Program to display the minimum and maximum value of primitive data types.Example Live Demopublic class Demo {    public static void main(String[] args) {       System.out.println("Integer Datatype values...");       System.out.println("Min = " + Integer.MIN_VALUE);       System.out.println("Max = " ... Read More

Default value of primitive data types in Java

Samual Sam
Updated on 26-Jun-2020 10:06:32

11K+ Views

Primitive datatypes are predefined by the language and named by a keyword in Java. Here is an example to display the default value of primitive data types.Example Live Demopublic class Demo {    static boolean val1;    static double val2;    static float val3;    static int val4;    static long val5;    static String val6;    public static void main(String[] args) {       System.out.println("Default values.....");       System.out.println("Val1 = " + val1);       System.out.println("Val2 = " + val2);       System.out.println("Val3 = " + val3);       System.out.println("Val4 = " + val4);   ... Read More

tanh() function in PHP

Samual Sam
Updated on 27-Dec-2019 10:03:38

63 Views

The tanh() function returns the hyperbolic tangent of the specified value.Syntaxtanh(val)Parametersval − A value in radiansReturnThe tanh() function returns the hyperbolic tangent of the specified value val.ExampleThe following is an example to get the hyperbolic tangent of 0 and 1: Live DemoOutput00.76159415595576ExampleLet us see an example to get the hyperbolic tangent of constant M_PI_4 − Live DemoOutput0.65579420263267ExampleLet us see an example to get the hyperbolic tangent of values 0.50 and -0.50 − Live DemoOutput0.46211715726001-0.46211715726001ExampleLet us see another example to get the hyperbolic tangent of negative values − Live DemoOutput-0.9999092042626-0.99999999587769

tan() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 10:02:10

36 Views

The tan() function returns the tangent of the specified value.Syntaxtan(val)Parametersval − A value in radiansReturnThe tan() function returns the tangent of the specified value val.Example Live DemoOutput01.5574077246549ExampleLet us see another example − Live DemoOutput1ExampleLet us see another example − Live DemoOutput0.54630248984379-0.54630248984379ExampleLet us see another example − Live DemoOutput3.3805150062466-0.64836082745909

srand() function in PHP

Samual Sam
Updated on 27-Dec-2019 10:01:04

120 Views

The mt_srand() function seeds the random number generator.Note − Random number generator is seeded automatically after the release of PHP 4.2.0. This function is not needed now.Syntaxsrand(seed)Parametersseed − The seed valueReturnThe srand() function Returns nothing.Example Live DemoOutput664617053ExampleLet us see another example − Live DemoOutput4

sqrt() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 10:00:14

43 Views

The sqrt() function Returns the square root of a number.Syntaxsqrt(num)Parametersnum − The number for which you want to find the square rootReturnThe sqrt() function Returns the square root of the specified number.Example Live DemoOutput4ExampleLet us see another example − Live DemoOutput0.5ExampleLet us see another example − Live DemoOutputNAN

sinh() function in PHP

Samual Sam
Updated on 27-Dec-2019 09:59:16

44 Views

The sinh() function Returns the hyperbolic sine of a number equivalent to.(exp(num) - exp(-num))/2)Syntaxsinh(num)Parametersnum − The number for which you want to Return the hyperbolic sine. A value in radians.ReturnThe sinh() function Returns the hyperbolic sine of a number.Example Live DemoOutput01.1752011936438ExampleLet us see another example − Live DemoOutput11.5487393572582.3012989023073

zip_read() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 09:58:15

19 Views

The zip_read() function reads the next entry in a ZIP file archive.Syntaxzip_read(zip)Parameterszip − The zip resource to readReturnThe zip_read() function returns a resource containing a file within the zip archive on success.ExampleThe following is an example, wherein we have a zip file "new.zip", with the following files.amit.txt peter.txt result.html demo.java settings.iniExampleLet us now see the example:OutputFile Name = amit.txt File Name = peter.txt File Name = result.html File Name = demo.java File Name = settings.ini

zip_open() function in PHP

Samual Sam
Updated on 26-Jun-2020 09:56:31

32 Views

The zip_open() function opens a zip file for reading. It returns an open zip file on success and FALSE on failure.Syntaxzip_open(zip_file)Parameterszip_file − The path of the file to be opened.ReturnThe zip_open() function returns an open zip file on success and FALSE on failure.ExampleOutputCompressed: 90 Compressed: 12 Compressed: 67

Advertisements