Fendadis John

Fendadis John

40 Articles Published

Articles by Fendadis John

40 articles

How to add a YouTube Video to your Website?

Fendadis John
Fendadis John
Updated on 11-Mar-2026 910 Views

To add a YouTube Video to your website, you need to embed it. To embed a video in an HTML page, use the element. The source attribute included the video URL. For the dimensions of the video player, set the width and height of the video appropriately.The Video URL is the video embed link. The video we will be embedding our example will be YouTube.To get the embed link, go to a YouTube Video and click embed as shown below. You will get a link fro embed here −You can try to run the following code to learn how ...

Read More

How to set the list-item marker type with JavaScript?

Fendadis John
Fendadis John
Updated on 11-Mar-2026 524 Views

To set the type of the list-item marker type, use the listStyleType property. The marker type can be square, circle, dic, etc.ExampleYou can try to run the following code to set the list-item marker type with JavaScript −                    One          Two             Update list style type (square)       Update list style type (decimal)                function displaySquare() {             document.getElementById("myID").style.listStyleType = "square";          }          function displayDecimal() {             document.getElementById("myID").style.listStyleType = "decimal";          }          

Read More

What should be done with the left/ right edges of the content on overflow with JavaScript?

Fendadis John
Fendadis John
Updated on 11-Mar-2026 145 Views

If the content overflows, the workaround with overflowX property to solve the left/ right edge issues and set a scroll. Adding a scroll allows visitors to easily read the entire content.ExampleYou can try to run the following code to learn what is to be done with the left/ right edges of the content on overflow with JavaScript −                    #box {             width: 350px;             height: 150px;             background-color: orange;           ...

Read More

How to set the shape of the border of the top-right corner with JavaScript?

Fendadis John
Fendadis John
Updated on 11-Mar-2026 262 Views

To set the shape of the border of the top-right corner in JavaScript, use the borderTopRightRadius property. Set border radius using this property.ExampleYou can try to run the following code to learn how to set the shape of the top-right border with JavaScript.                    #box {             border: thick solid gray;             width: 300px;             height: 200px          }                     Demo Text             Change top right border radius                function display() {             document.getElementById("box").style.borderTopRightRadius = "20px";          }          

Read More

How to import java.lang.String class in Java?

Fendadis John
Fendadis John
Updated on 11-Mar-2026 18K+ Views

To import any package in the current class you need to use the import keyword asimport packagename;Exampleimport java.lang.String; public class Sample {    public static void main(String args[]) {       String s = new String("Hello");       System.out.println(s);    } }OutputHello

Read More

Use static Import for sqrt() and pow() methods in class Math in Java

Fendadis John
Fendadis John
Updated on 11-Mar-2026 1K+ Views

Static import means that the fields and methods in a class can be used in the code without specifying their class if they are defined as public static.The Math class methods sqrt() and pow() in the package java.lang are static imported. A program that demonstrates this is given as follows:Exampleimport static java.lang.Math.sqrt; import static java.lang.Math.pow; public class Demo {    public static void main(String args[]) {       double num = 4.0;       System.out.println("The number is: " + num);       System.out.println("The square root of the above number is: " + sqrt(num));       System.out.println("The ...

Read More

Name validation using Java Regular Expressions

Fendadis John
Fendadis John
Updated on 11-Mar-2026 1K+ Views

The name can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the name and the given input name and returns true if they match and false otherwise.A program that demonstrates this is given as follows:Examplepublic class Demo {    public static void main(String args[]) {       String name = "John Harry Smith";       String regexName = "\p{Upper}(\p{Lower}+\s?)";       String patternName = "(" + regexName + "){2, 3}";       System.out.println("The name is: " + name);       System.out.println("Is the above name valid? " + name.matches(patternName));    } ...

Read More

Sorting collection of String and StringBuffer in Java

Fendadis John
Fendadis John
Updated on 11-Mar-2026 937 Views

In order to sort in Java as we know we can use either Comparable or Comparator interfaces in which we could also define our custom logic to sort.One of the approach to sort is to add the entity in TreeSet or TreeMap which would sort the entries as internally they also uses the comparable interface. Now String class in Java internally implements comparable interface so whenever we add string to a tree set or map it uses comparable logic of string class and sort the input entry strings.But String buffer do not have the implementation of comparable interface so ...

Read More

final, finally and finalize in Java

Fendadis John
Fendadis John
Updated on 29-Jul-2021 12K+ Views

The final keyword can be used with class method and variable. A final class cannot be inherited, a final method cannot be overridden and a final variable cannot be reassigned.The finally keyword is used to create a block of code that follows a try block. A finally block of code always executes, whether or not an exception has occurred. Using a finally block allows you to run any cleanup-type statements that you just wish to execute, despite what happens within the protected code.The finalize() method is used just before object is destroyed and can be called just prior to object ...

Read More

How to sort string array in android listview?

Fendadis John
Fendadis John
Updated on 26-Jun-2020 688 Views

This example demonstrate about How to sort string array in android listview.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml         In the code, we have taken listview to show a sorted arrayStep 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import java.util.Arrays; public class MainActivity extends AppCompatActivity {    ListView list;    String[] array = {"2", "5", ...

Read More
Showing 1–10 of 40 articles
« Prev 1 2 3 4 Next »
Advertisements