karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 5 of 143

CharBuffer slice() method in Java

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

A new CharBuffer with the content as a shared subsequence of the original CharBuffer can be created using the method slice() in the class java.nio.CharBuffer. This method returns the new CharBuffer that is read-only if the original buffer is read-only and direct if the original buffer is direct.A program that demonstrates this is given as follows −Exampleimport java.nio.*; import java.util.*; public class Demo {    public static void main(String[] args) {       int n = 5;       try {          CharBuffer buffer1 = CharBuffer.allocate(n);          buffer1.put('A');         ...

Read More

HTML DOM Input Image Object

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

The HTML DOM input image Object represent the element with type=”image” of an HTML document.Let’s see how to create input image object −SyntaxFollowing is the syntax −var imageInput = document.createElement(“INPUT”); imageInput.setAttribute(“type”, ”image”);PropertiesFollowing are the properties of HTML DOM input image Object −PropertyExplanationAltIt returns and modify the value of the alt attribute of an input image.AutofocusIt returns whether the browser finished loading an image in HTML web page or not.defaultValueIt returns and modify the default value of an input image.DisabledIt returns and modify the value of the disabled attribute of an input image.FormIt returns the reference of the form that ...

Read More

How to write an if-else statement in a JSP page?

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

The if...else block starts out as an ordinary Scriptlet, but the Scriptlet is closed at each line with HTML text included between the Scriptlet tags.Example           IF...ELSE Example                         Today is weekend                 Today is not weekend           The above code will generate the following result −Today is not weekend

Read More

Java Program to get previous and next index using ListIterator

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

To get the exact evaluation of the previous and next index, you need use the next() method of the Iterator. This will eventually help you in gaining more understanding about Iterators. Let us first create an ArrayList and add some elements −ArrayList arrList = new ArrayList (); arrList.add(100); arrList.add(200); arrList.add(300); arrList.add(400); arrList.add(500); arrList.add(600); arrList.add(700); arrList.add(800); arrList.add(900); arrList.add(1000);Now, create a ListIterator −ListIteratoriterator = arrList.listIterator();Get the previous and next index now −iterator.previousIndex(); iterator.nextIndex();Exampleimport java.util.ArrayList; import java.util.ListIterator; public class Demo {    public static void main(String[] args) {       ArrayListarrList = new ArrayList();       arrList.add(100);     ...

Read More

HTML DOM Input Month Object

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

The HTML DOM input month Object represent the element with type=”month”.Let us create input month object −SyntaxFollowing is the syntax −var monthInput = document.createElement(“INPUT”); monthInput.setAttribute(“type”, ”month”);PropertiesFollowing are the properties of HTML DOM input month Object −PropertyExplanationautocompleteIt returns and alter the value of the autocomplete attribute of month input field.autofocusIt returns and modify whether the input month field should get focused or not when page load.disabledIt returns and modify whether the input month field is disabled or not.defaultValueIt returns and alter the default value of the input month field.formIt returns the reference of the form that contain the input month ...

Read More

LinkedBlockingQueue Class in Java

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

The LinkedBlockingQueue Class in Java has a blocking queue that is optionally bounded and based on linked nodes. This means that if the capacity is provided then the LinkedBlockingQueue is bound, otherwise it is not bound. Also, FIFO for ordering elements.A program that demonstrates this is given as follows −Exampleimport java.util.concurrent.LinkedBlockingQueue; public class Demo {    public static void main(String[] args) {       LinkedBlockingQueue lbQueue = new LinkedBlockingQueue();       lbQueue.add("Amy");       lbQueue.add("John");       lbQueue.add("May");       lbQueue.add("Harry");       lbQueue.add("Anne");       System.out.println("The elements in LinkedBlockingQueue are: " + ...

Read More

How to remove all elements from a Collection in another Collection

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

Let’s say the following is our Collection i.e. ArrayList −Listlist = new ArrayList(); list.add(100); list.add(200); list.add(200); list.add(200); list.add(300); list.add(400); list.add(400); list.add(500);Now, create another Collection −List list2 = new ArrayList(); list2.add(100); list2.add(200); list2.add(300); list2.add(400);To remove all elements from a Collection in another Collection, try the following with list and list2 as our two Collections −list.removeAll(list2);Exampleimport java.util.ArrayList; import java.util.List; public class Demo {    public static void main(String args[]) throws Exception {       Listlist = new ArrayList();       list.add(100);       list.add(200);       list.add(200);       list.add(200);       list.add(300);       ...

Read More

HTML DOM Input Month name Property

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

The HTML DOM input month name property returns and modify the value of the name attribute of the input field of type=”month” in a HTML document.SyntaxFollowing is the syntax −1. Returning nameobject.name2. Modifying nameobject.name = “text”ExampleLet us see an example of HTML DOM input month name property −    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%)       center/cover no-repeat;       height:100%;    }    p{       font-weight:700;       font-size:1.2rem;   ...

Read More

HTML DOM Input Month max Property

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

The HTML DOM input month max property returns and modify the value of the max attribute of the input field of type=”month” in a HTML document.SyntaxFollowing is the syntax −1. Returning maxobject.max2. Modifying maxobject.max = “YYYY-MM”Here, YYYY represent year and MM represent month like “2019-02”ExampleLet us see an example of HTML DOM input month max property −    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%)       center/cover no-repeat;       height:100%;    }    p{ ...

Read More

Program to iterate over a List using Java 8 Lambda

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

Let us first create a List and add elements −ArrayListarrayList = new ArrayList(); arrayList.add("100"); arrayList.add("200"); arrayList.add("300"); arrayList.add("400"); arrayList.add("500");Now, iterate over it with Lambda Expressions −ArrayListlist = arrayList; System.out.println("Iterating..."); list.stream().forEach(elem -> System.out.println(elem));Exampleimport java.util.ArrayList; import java.util.List; public class Demo {    public static void main(String[] args) {       ArrayListarrayList = new ArrayList();       arrayList.add("100");       arrayList.add("200");       arrayList.add("300");       arrayList.add("400");       arrayList.add("500");       arrayList.add("600");       arrayList.add("700");       arrayList.add("800");       arrayList.add("900");       arrayList.add("1000");       System.out.println("ArrayList...");       for ...

Read More
Showing 41–50 of 1,421 articles
« Prev 1 3 4 5 6 7 143 Next »
Advertisements