Samual Sam has Published 2492 Articles

JSON Formatting in Python

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:26:45

8K+ Views

The JSON (Java Script Object Notation) is light weight, well accepted data interchange format. Using JSON formatting techniques in Python, we can convert JSON strings to Python objects, and also convert Python Objects to JSON strings.To use these functionalities, we need to use the json module of Python. The json ... Read More

Java Program to compare two Java char Arrays

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:21:12

273 Views

To compare two Java char arrays, use the Arrays.equals() method.Let us first declare and initialize some char arrays.char[] arr1 = new char[] { 'p', 'q', 'r' }; char[] arr2 = new char[] { 'p', 'r', 's' }; char[] arr3 = new char[] { 'p', 'q', 'r' };Now let us compare ... Read More

Merge two sorted arrays in Python using heapq?

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:19:06

416 Views

In this section we will see how two sorted lists can be merged using the heapq module in Python. As an example, if list1 = [10, 20, 30, 40] and list2 = [100, 200, 300, 400, 500], then after merging it will return list3 = [10, 20, 30, 40, 100, ... Read More

Check whether the entered value is a letter or not in Java

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:16:51

5K+ Views

To check whether the entered value is a letter or not in Java, use the Character.isLetter() method.We have a value to be checked.char val = 'D';Now let us use the Character.isLetter() method.if (Character.isLetter(val)) {    System.out.println("Character is in Lowercase!"); }else {    System.out.println("Character is in Uppercase!"); }Let us see the ... Read More

isLetterOrDigit() method in Java

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:15:23

104 Views

The isLetterOrDigit() method in Java returns TRUE if the entered value is a letter or digit.We have the following character.char val ='P';Now, let us check for letter or digit using if-else decision-making statement.if (Character.isLetterOrDigit(val)) {    System.out.println("Value is a letter or digit!"); } else {    System.out.println("Value is neither a ... Read More

Java Program to check whether the entered character a digit, white space, lower case or upper case character

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:13:37

784 Views

To check whether the entered character is a digit, whitespace, lowercase or uppercase, you need to check for the ASCII values.Let’s say we have a value in variable “val”, which is to be checked.For Lower Case.if(val >= 97 && val = 65 && val = 48 && val = 97 ... Read More

Copy char array to string in Java

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:11:17

15K+ Views

Use the valueOf() method in Java to copy char array to string. You can also use the copyValueOf() method, which represents the character sequence in the array specified. Here, you can specify the part of array to be copied.Let us first create a character array.char[] arr = { 'p', 'q', ... Read More

Java Program to determine a Character's Unicode Block

Samual Sam

Samual Sam

Updated on 26-Jun-2020 12:10:26

313 Views

To determine a Character’s Unicode Block, use the Character.UnicodeBlock.of() method in Java. The method returns the object representing the Unicode block containing the given character, or null if the character is not a member of a defined block.Let us see the syntax of Character.UnicodeBlock.of() method.Character.UnicodeBlock of(char c)Here, c is the ... Read More

Parse and format a number to decimal in Java

Samual Sam

Samual Sam

Updated on 26-Jun-2020 10:55:20

310 Views

To parse and format a number to decimal, try the following code.Example Live Demopublic class Demo {    public static void main( String args[] ) {       int val = Integer.parseInt("5");       String str = Integer.toString(val);       System.out.println(str);    } }Output5In the above program, we ... Read More

Pass an integer by reference in Java

Samual Sam

Samual Sam

Updated on 26-Jun-2020 10:54:21

961 Views

To pass an integer by reference in Java, try the following code −Example Live Demopublic class Demo {    public static void display(int[] arr) {       arr[0] = arr[0] + 50;;    }    public static void main(String[] args) {       int val = 50;     ... Read More

Advertisements