AmitDiwan

AmitDiwan

8,392 Articles Published

Articles by AmitDiwan

Page 626 of 840

Display Inline Working with CSS

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 137 Views

The CSS Display property with value inline renders an element according to content’s width, it does not force a line break. An element with display as inline renders as a element.SyntaxFollowing is the syntax for CSS display inline −Selector {    display: inline; }ExampleLet’s see an example of CSS display inline − CSS Display Inline form {    width:70%;    margin: 0 auto;    text-align: center; } * {    padding: 2px;    margin:5px;    box-sizing: border-box; } input[type="button"] {    border-radius: 10px; } .child{    height: 40px;    color: white;    border: 4px solid black; ...

Read More

BinaryOperator Interface in Java

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 2K+ Views

The BinaryOperator interface represents an operation upon two operands of the same type, producing a result of the same type as the operands.Following are the methods −Modifier and TypeMethod and DescriptionmaxBy(Comparator

Read More

HTML DOM TouchEvent targetTouches Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 252 Views

The HTML DOM TouchEvent targetTouches property returns a TouchList object corresponding to a list of all contact points triggered on a touch surface.NOTE: If a touch is triggered on the specified node or any of its child nodes then the following touches will only count if they are also triggered on the same node.Following is the syntax −Returning TouchList objectevent.targetTouchesNote: We ran Touch event examples on Online HTML Editors accessed on Mobile or systems with touch access. This is done so that we can perform touch operations like touch the screen for 2 seconds.Let us see an example of TouchEvent ...

Read More

How to create a shallow copy of Hashtable in C#?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 339 Views

To create a shallow copy of Hashtable, the code is as follows −Exampleusing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable hash = new Hashtable();       hash.Add("1", "AB");       hash.Add("2", "BC");       hash.Add("3", "DE");       hash.Add("4", "EF");       hash.Add("5", "GH");       hash.Add("6", "IJ");       hash.Add("7", "KL");       hash.Add("8", "MN");       hash.Add("9", "OP");       hash.Add("10", "QR");       Console.WriteLine("Hashtable elements...");       foreach(DictionaryEntry d in hash) {       ...

Read More

How to sort HashSet in Java

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 2K+ Views

To sort HashSet in Java, you can use another class, which is TreeSet.Following is the code to sort HashSet in Java −Exampleimport java.util.*; public class Main {    public static void main(String args[]) {       Set hashSet = new HashSet();       hashSet.add("green");       hashSet.add("blue");       hashSet.add("red");       hashSet.add("cyan");       hashSet.add("orange");       hashSet.add("green");       System.out.println("HashSet elements"+ hashSet);       Set treeSet = new TreeSet(hashSet);       System.out.println("Sorted elements"+ treeSet);    } }OutputHashSet elements [red, orange, green, blue, cyan] Sorted elements [blue, cyan, green, ...

Read More

Compare two Strings in Java

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 476 Views

Compare two strings using compareTo() method in Java. The syntax is as follows −int compareTo(Object o)Here, o is the object to be compared.The return value is 0 if the argument is a string lexicographically equal to this string; a value less than 0 if the argument is a string lexicographically greater than this string; and a value greater than 0 if the argument is a string lexicographically less than this string.ExampleLet us now see an example −public class Demo {    public static void main(String args[]) {       String str1 = "Strings are immutable";       String ...

Read More

HTML DOM Input URL Object

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 264 Views

The HTML DOM Input URL Object represents an input HTML element with type url.SyntaxFollowing is the syntax −Creating an with type url.var urlObject = document.createElement(“input”); urlObject.type = “url”;AttributesHere, “urlObject” can have the following attributes −AttributesDescriptionautocompleteIt provides suggestions based on previously typed text, if set to ‘ON’autofocusIf set to true the url field is focused upon initial page load.defaultValueIt sets/returns the default value of an url fielddisabledIt defines if an url field is disabled/enabledformIt returns a reference of enclosing form that contains the url fieldmaxLengthIt returns/sets the value of maxLength attribute of an url fieldnameIt defines the value of name ...

Read More

Check if a string contains only alphabets in Java using Regex

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 1K+ Views

At first, convert the string into character array. Here, name is our string −char[] ch = name.toCharArray();Now, loop through and find whether the string contains only alphabets or not. Here, we are checking for not equal to a letter for every character in the string −for (char c : ch) {    if(!Character.isLetter(c)) {       return false;    }Following is an example to check if a string contains only alphabets using RegexExamplepublic class Main {    public static boolean checkAlphabet(String name) {       char[] ch = name.toCharArray();       for (char c : ch) {   ...

Read More

HTML DOM Input URL type Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 210 Views

The HTML DOM Input URL type property returns/sets type of Input URL.SyntaxFollowing is the syntax −Returning string valueinputURLObject.typeSetting type to string valueinputURLObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsemailIt defines that input type is emailurlIt defines that input type is urlradioIt defines that input type is radiotelIt defines that input type is tel and a number keypad is shown for inputExampleLet us see an example for Input URL type property − Input URL type    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * ...

Read More

Java Program to Convert the ArrayList into a String and Vice Versa

AmitDiwan
AmitDiwan
Updated on 23-Jan-2025 535 Views

In this article, we will understand how to convert the ArrayList into a string and vice versa. The ArrayList class is a resizable array, which can be found in the java. util package. The difference between a built-in array and an ArrayList in Java is that the size of an array cannot be modified. ArrayList definitionAn ArrayList in Java is a resizable array found in the java.util package, which allows for dynamic modifications in size as elements are added or removed. It supports ...

Read More
Showing 6251–6260 of 8,392 articles
« Prev 1 624 625 626 627 628 840 Next »
Advertisements