Karthikeya Boyini has Published 2383 Articles

Concatenate null to a string in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 14:36:18

3K+ Views

To concatenate null to a string, use the + operator.Let’s say the following is our string.String str = "Demo Text";We will now see how to effortlessly concatenate null to string.String strNULL = str + "null";The following is the final example.Example Live Demopublic class Demo {     public static void main(String[] args) {        String str = "Demo Text";   ... Read More

Java Program to compare strings for equality

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 14:31:46

176 Views

To compare string for equality in Java, use the equals() method. Let us see some examples wherein we have checked for same as well as different string values.Example Live Demopublic class Demo {     public static void main(String[] args) {        String one = "x";        String two = "x";        if(one.equals(two)) {           ... Read More

Scraping and Finding Ordered Word in a Dictionary in Python

karthikeya Boyini

karthikeya Boyini

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

523 Views

For solving this problem we need requests module.For installing requests module, we need this command to get executed at command line.pip install requestsScrapingImport requests module.Then we need to fetch data from URL.Using UTF-8 decode the text.Then convert string into a list of words.Ordered FindingTraverse the list of words using loop.Then ... Read More

Comparison of Float in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 12:34:33

167 Views

To compare Float in Java, use the following methods −Method 1 − compareTo(newFloat) method in JavaThe java.lang.Float.compareTo() method compares two Float objects. This method returns the value 0 if the new float value is numerically equal to this Float; a value less than 0 if this Float is numerically less ... Read More

Page Rank Algorithm and Implementation using Python

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 12:32:55

4K+ Views

The PageRank algorithm is applicable in web pages. Web page is a directed graph, we know that the two components of Directed graphsare -nodes and connections. The pages are nodes and hyperlinks are the connections, the connection between two nodes.We can find out the importance of each page by the ... Read More

Convert string to char array in Java

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

The following is our string.String str = "Tutorial";Now, use the toCharArray() method to convert string to char array.char[] ch = str.toCharArray();Now let us see the complete example.Example Live Demopublic class Demo {    public static void main(String []args) {       String str = "Tutorial";       System.out.println("String: "+str); ... Read More

Determine if a String is a legal Java Identifier

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 12:20:41

691 Views

To determine if a String is a legal Java Identifier, use the Character.isJavaIdentifierPart() and Character.isJavaIdentifierStart() methods.Character.isJavaIdentifierPart()The java.lang.Character.isJavaIdentifierPart() determines if the character (Unicode code point) may be part of a Java identifier as other than the first character.A character may be part of a Java identifier if any of the following ... Read More

Creating child process using fork() in Python

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

Our task is to create a child process and display process id of both parent and child process using fork() function in Python.When we use fork(), it creates a copy of itself, it is a very important aspect of LINUX, UNIX. fork() is mainly applicable for multithreading environment that means ... Read More

Java Program to validate if a String contains only numbers

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

To validate if a String has only numbers, you can try the following codes. We have used the matches() method in Java here to check for number in a string.Example Live Demopublic class Demo {    public static void main(String []args) {       String str = "978";     ... Read More

Check whether the entered value is whitespace or not in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 12:14:28

3K+ Views

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

Advertisements