Jai Janardhan

Jai Janardhan

40 Articles Published

Articles by Jai Janardhan

Page 2 of 4

Find the minimum element of a Vector in Java

Jai Janardhan
Jai Janardhan
Updated on 11-Mar-2026 570 Views

The minimum element of a Vector can be obtained using the java.util.Collections.min() method. This method contains a single parameter i.e. the Vector whose minimum element is determined and it returns the minimum element from the Vector.A program that demonstrates this is given as follows −Exampleimport java.util.Collections; import java.util.Vector; public class Demo {    public static void main(String args[]) {       Vector vec = new Vector();       vec.add(7);       vec.add(3);       vec.add(9);       vec.add(5);       vec.add(8);       System.out.println("The Vector elements are: " + vec);       ...

Read More

Swap two variables in one line in Java

Jai Janardhan
Jai Janardhan
Updated on 11-Mar-2026 1K+ Views

In order to swap two variable using single expression or in single line we could use bitwise XOR operator of Java. As we now that in Java XOR functions as XOR of two numbers a and b returns a number which has all the bits as 1 wherever bits of a and b differs. So for swapping of two variable we would use this operator as Example public class SwapUsingBitwise { public static void main(String[] args) { int a = 8 ; int b = 10; ...

Read More

What are final, abstract, synchronized non-access modifiers in Java?

Jai Janardhan
Jai Janardhan
Updated on 11-Mar-2026 515 Views

The abstract keyword is used to declare methods abstract methods and abstract classes. Once a method is declared abstract we should not specify body for those. And once a class is declared abstract it cannot be instantiated. Example abstract class Employee { private String name; private String address; private int number; public Employee(String name, String address, int number) { System.out.println("Constructing an Employee"); this.name = name; ...

Read More

How to set the right margin of an element with JavaScript?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 653 Views

Use the marginRight property in JavaScript, to set the right margin. You can try to run the following code to set the right margin of an element with JavaScript − Example             #myID {        border: 2px solid #000000;      }              This is demo text.    Add right margin          function display() {        document.getElementById("myID").style.marginRight = "150px";      }       

Read More

How to set the position of the list-item marker with JavaScript?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 241 Views

To set the position of the marker of the list-item, use the listStylePosition property. You can try to run the following code to set the position of the list-item marker with JavaScript − Example             One      Two        Add list inside    Add list outside          function displayInside() {       document.getElementById("myID").style.listStylePosition = "inside";      }      function displayOutside() {       document.getElementById("myID").style.listStylePosition = "outside";      }       

Read More

How to set whether the style of the font is normal, italic or oblique with JavaScript?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 168 Views

To set the style of the font, use the fontStyle property. You can try to run the following code to set the style of the font to normal, italic or oblique with JavaScript − Example       Heading 1          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.      This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.        Set Font Family and Style          function display() {       document.getElementById("myID").style.fontFamily = "verdana,sans-serif";       document.getElementById("myID").style.fontStyle = "italic";      }       

Read More

How to create a table caption with JavaScript DOM?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 650 Views

To create a table caption, use the DOM createCaption() method. Example You can try to run the following code to learn how to create table caption −             function captionFunc(x) {        document.getElementById(x).createCaption().innerHTML = "Demo Caption";      }                            One        Two                    Three        Four                    Five        Six                           

Read More

How can I return the values of columns from MySQL table as a set of values?

Jai Janardhan
Jai Janardhan
Updated on 22-Jun-2020 280 Views

With the help of MySQL MAKE_SET() function, we can return the values of columns from MySQL table as a set of values. To understand it, we are taking the example of Student_Name table which has the following data −mysql> Select * from Student_Name; +---------+-------+---------+ | FName   | Mname | Lname   | +---------+-------+---------+ | Rahul   | NULL  | Singh   | | Gaurav  | Kumar | NULL    | | Harshit | NULL  | Khurana | | Yash    | Pal   | Sharma  | +---------+-------+---------+ 4 rows in set (0.00 sec)Now, suppose if we want to make ...

Read More

What is the use of MySQL IFNULL() control flow function?

Jai Janardhan
Jai Janardhan
Updated on 22-Jun-2020 301 Views

MySQL IFNULL() control flow function will return the first argument if it is not NULL otherwise it returns the second argument.SyntaxIFNULL(expression1, expression2)Here if expression1 is not NULL then IFNULL() will return expression1 otherwise expression2. It will return NULL if both of the arguments are NULL. Following example will exhibit this −mysql> Select IFNULL(NULL, 'Ram'); +--------------------+ | IFNULL(NULL, 'Ram') | +--------------------+ | Ram                | +--------------------+ 1 row in set (0.00 sec) mysql> Select IFNULL('Shyam', 'Ram'); +-----------------------+ | IFNULL('Shyam', 'Ram') | +-----------------------+ | Shyam                 | +-----------------------+ ...

Read More

How MySQL FIELD() and ELT() functions are complements of each other?

Jai Janardhan
Jai Janardhan
Updated on 20-Jun-2020 217 Views

On the basis of the working of both the functions, we can say that both are the complement of each other. Actually, as we know that FIELD() function, on providing a string as an argument, returns the index number of the string from string list and ELT() function, on providing index number as an argument, returns the string from string list. In the following example, we have applied both the functions on the same string, it would demonstrate the concept −Examplemysql> SELECT ELT(4, 'Ram', 'is', 'good', 'boy')As Result; +--------+ | Result | +--------+ | boy    | +--------+ ...

Read More
Showing 11–20 of 40 articles
Advertisements