karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 16 of 143

C# Nullable Datetime

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 17K+ Views

Using the DateTime nullable type, you can assign the null literal to the DateTime type.A nullable DateTime is specified using the following question mark syntax.DateTime?The following is the code to implement Nullable Datetime.Exampleusing System; class Program {    static void Main() {       DateTime? dt = null;       DateFunc(dt);       dt = DateTime.Now;       DateFunc(dt);       dt = null;       Console.WriteLine(dt.GetValueOrDefault());    }    static void DateFunc(DateTime? dt) {       if (dt.HasValue) {          Console.WriteLine(dt.Value);       } else {          Console.WriteLine(0);       }    } }Output0 9/17/2018 8:27:07 AM 1/1/0001 12:00:00 AM

Read More

log() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 273 Views

The log() function Returns the natural logarithm of a number.Syntaxlog(num, base)Parametersnum − The value for which you want to calculate the logarithmbase − The logarithmic baseReturnThe log() function Returns the natural logarithm of a number.ExampleOutput0ExampleLet us see another example −Output-INFExampleLet us see another example −Output2.3025850929940.99325177301028

Read More

Java Program to format to 2 decimal places in a 10-character field

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 210 Views

To format, use the Formatter class. Import the following package to work with the Formatter class in Java −import java.util.Formatter;Create a Formatter object and format to 2 decimal places in a 10-character field −Formatter f = new Formatter(); System.out.println(f.format("%10.2e", 3989.7886));The following is the complete example −Exampleimport java.util.Formatter; public class Demo { public static void main(String args[]) { Formatter f = new Formatter(); System.out.println(f.format("%08d", 697)); f = new Formatter(); System.out.println(f.format("%03d", 9878)); f = new Formatter(); System.out.println(f.format("%10.2e", 3989.7886)); } }Output00000697 9878 3.99e+03

Read More

Performing Bitwise Operations with BigInteger in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 361 Views

BigInteger class is used for big integer calculations which are outside the limit of the primitive data types. It provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations.Let us work with the testBit() method in Java to perform Bitwise operation. The java.math.BigInteger.testBit(int n) returns true if and only if the designated bit is set −The following is an example −Exampleimport java.math.*; public class BigIntegerDemo {    public static void main(String[] args) {       BigInteger one;       Boolean two;       one = new BigInteger("5");   ...

Read More

ArrayBuffer.isView() function in JavaScript

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 298 Views

ArrayBuffer object in JavaScript represents a fixed-length binary data buffer. The isView() function of this object accepts an argument and verifies whether it is view of ArrayBuffer (DataView, typed array). If so, it returns true else, it returns false.SyntaxIts syntax is as followsarrayBuffer.isView(arg)ExampleTry the following example.    JavaScript Example           var arrayBuffer = new ArrayBuffer(5);       arrayBuffer = ["apple", "orange", "mango"];       var bool = ArrayBuffer.isView(new Int32Array())       document.write(bool);     OutputtrueExampleIn the same way if we try executing this function by passing an object other ...

Read More

log1p() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 165 Views

The log1p() function Returns log(1+number), computed in a way that is accurate even when the value of number is close to zero.Syntaxlog1p(val)Parametersval − The specified numberReturnThe log1p() function Returns log(1+number), computed in a way that is accurate even when the value of number is close to zero.ExampleOutput0.69314718055995ExampleLet us see another example −Output0ExampleLet us see another example −Output2.39789527279841.3083328196502

Read More

Get the system properties from RuntimeMXBean in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 401 Views

RuntimeMXBean in the management interface for the runtime system of the Java virtual machine.RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean();To get the system properties, use the getSystemProperties() method −System.out.println("System properties from RuntimeMXBean: "+runtimeMX.getSystemProperties());The following is an example −Exampleimport java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class Demo { public static void main(String args[]) throws Exception { RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean(); System.out.println("System properties from RuntimeMXBean: "+runtimeMX.getSystemProperties()); } }OutputSystem properties from RuntimeMXBean: {awt.toolkit=sun.awt.X11.XToolkit, file.encoding.pkg=sun.io, java.specification.version=1.8, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, java.class.path=/home/cg/root/GNUstep/Library/Libraries/Java:/usr/GNUstep/Local/Library/Libraries/Java:/usr/G NUstep/System/Library/Libraries/Java::/usr/share/java/mysql-connector- java.jar:.:/var/www/html/lib:/var/www/html/lib/dom4j-1.6.jar:/var/www/html/lib/guava- 18.0.jar:/var/www/html/lib/jackson-all.jar:/var/www/html/lib/jaxen- 1.1.4.jar:/var/www/html/lib/jcommon.jar:/var/www/html/lib/jdom2- 2.0.5.jar:/var/www/html/lib/jfreechart.jar:/var/www/html/lib/junit-4.12.jar:/var/www/html/lib/spymemcached- 2.10.3.jar:/var/www/html/lib/stax-1.2.0.jar:/var/www/html/lib/xstream-1.4.7.jar:/var/www/html/lib/gson- 2.3.1.jar:/var/www/html/lib/hamcrest-core-1.3.jar, java.vm.vendor=Oracle Corporation, sun.arch.data.model=64, ...

Read More

Character constants vs String literals in C#

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 521 Views

Character constantsCharacter literals are enclosed in single quotes. For example, 'x' and can be stored in a simple variable of char type. A character literal can be a plain character (such as 'x'), an escape sequence (such as '\t'), or a universal character (such as '\u02C0').Certain characters in C# are preceded by a backslash. They have special meaning and they are used to represent like newline () or tab (\t).Exampleusing System; namespace Demo {    class MyApplication {       static void Main(string[] args) {          Console.WriteLine("Welcome\t to the website");          Console.ReadLine();   ...

Read More

Get ClassPath from RuntimeMXBean in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 183 Views

RuntimeMXBean in the management interface for the runtime system of the Java virtual machine.RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean();To get the class path, use the getClassPath() method −runtimeMX.getClassPath()The following is an example −Exampleimport java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class Demo { public static void main(String args[]) throws Exception { RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean(); System.out.println("Class path = "+runtimeMX.getClassPath()); } }OutputClass path = /home/cg/root/GNUstep/Library/Libraries/Java:/usr/GNUstep/Local/Library/Libraries/Java:/usr/GNUstep/System/ Library/Libraries/Java::/usr/share/java/mysql-connector-java.jar:.:/var/www/html/lib:/var/www/html/lib/dom4j- 1.6.jar:/var/www/html/lib/guava-18.0.jar:/var/www/html/lib/jackson-all.jar:/var/www/html/lib/jaxen- 1.1.4.jar:/var/www/html/lib/jcommon.jar:/var/www/html/lib/jdom2- 2.0.5.jar:/var/www/html/lib/jfreechart.jar:/var/www/html/lib/junit-4.12.jar:/var/www/html/lib/spymemcached- 2.10.3.jar:/var/www/html/lib/stax-1.2.0.jar:/var/www/html/lib/xstream-1.4.7.jar:/var/www/html/lib/gson- 2.3.1.jar:/var/www/html/lib/hamcrest-core-1.3.jar

Read More

min() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 156 Views

The min() function Returns the minimum value of an array.Syntaxmin(arr_values); or min(val1,val2,...);Parametersarr_values − The array with values.val1, val2 − The values to compare.ReturnThe min() function Returns the minimum value of an array.ExampleOutput12ExampleLet us see another example −Output12

Read More
Showing 151–160 of 1,421 articles
« Prev 1 14 15 16 17 18 143 Next »
Advertisements