Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by karthikeya Boyini
Page 7 of 143
HTML DOM Input Hidden Object
The HTML DOM input hidden object represents the element with type=”hidden” of an HTML document.Create input hidden object −SyntaxFollowing is the syntax −var hiddenInput = document.createElement(“INPUT”); hiddenInput.setAttribute(“type”, ”hidden”);PropertiesFollowing are the properties of HTML DOM input hidden Object −PropertyExplanationformIt returns the cite of the form that contain the hidden input field.nameIt returns and alter the value of name attribute of hidden input field.typeIt returns the value of type attribute of input field.defaultValueIt returns the value of type attribute of input field.defaultValueIt returns and modify the default value of the hidden input field.valueIt returns and modify the value of the value ...
Read MoreRetrieve environment variables with Java Map Collection
First, use the getenv() method to get the environment variables −System.out.println("PATH = " + System.getenv("PATH"));Now, get the key and value. Loop through to get the list of environment variables −Map e = System.getenv(); for (Iterator i = e.entrySet().iterator(); i.hasNext();) { Map.Entry mapEntry = (Map.Entry) i.next(); System.out.println(mapEntry.getKey() + " = " + mapEntry.getValue()); }The following is an example to retrieve environment variables with Map Collection −Exampleimport java.util.Iterator; import java.util.Map; public class Demo { public static void main(String args[]) { System.out.println("PATH = " + System.getenv("PATH")); ...
Read MoreHow to initialize a vector in C++?
Initialization vector can be done in many ways1) Initialize a vector by push_back() methodAlgorithmBegin Declare v of vector type. Call push_back() function to insert values into vector v. Print “Vector elements:”. for (int a : v) print all the elements of variable a. End.Example#include #include using namespace std; int main() { vector v; v.push_back(6); v.push_back(7); v.push_back(10); v.push_back(12); cout
Read MoreCustom ArrayList in Java
A custom ArrayList can have multiple types of data and its attributes in general are based on the user requirements.A program that demonstrates a custom ArrayList is given as follows −Exampleimport java.util.ArrayList; public class CustomArrayList { int n = 5; class Employee { int eno; String name; Employee(int eno, String name) { this.eno = eno; this.name = name; } } public static void main(String args[]) { int eno[] = {101, 102, 103, 104, ...
Read MoreHow to create Java Priority Queue to ignore duplicates?
The simplest way to create a Java Priority Queue to ignore duplicates is to first create a Set implementation −HashSet set = new HashSet (); set.add(100); set.add(150); set.add(250); set.add(300); set.add(250); set.add(500); set.add(600); set.add(500); set.add(900);Now, create Priority Queue and include the set to remove duplicates in the above set −PriorityQueuequeue = new PriorityQueue(set);Exampleimport java.util.HashSet; import java.util.PriorityQueue; public class Demo { public static void main(String[] args) { HashSetset = new HashSet(); set.add(100); set.add(150); set.add(250); set.add(300); set.add(250); set.add(500); ...
Read MoreArrayBlockingQueue Class in Java
A bounded blocking queue that is backed by an array is known as a ArrayBlockingQueue Class in Java. The size of the queue is fixed in the class and it uses FIFO for ordering elements. The ArrayBlockingQueue Class is a member of the Java Collections Framework.A program that demonstrates this is given as follows −Exampleimport java.util.concurrent.ArrayBlockingQueue; public class Demo { public static void main(String[] args) { int n = 10; ArrayBlockingQueue abQueue = new ArrayBlockingQueue(n); abQueue.add(7); abQueue.add(2); abQueue.add(6); abQueue.add(3); ...
Read MoreCharBuffer slice() method in Java
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 MoreHTML DOM Input Image Object
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 MoreHow to write an if-else statement in a JSP page?
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 MoreJava Program to get previous and next index using ListIterator
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