Samual Sam has Published 2492 Articles

CSS outline-width property

Samual Sam

Samual Sam

Updated on 25-Jun-2020 11:38:13

167 Views

The outline-width property is used to set the width of the outline. Its value should be a length or one of the values thin, medium, or thick, just like the border-width attribute.Example                            This text is having ... Read More

Add hours to current time using Calendar.add() method in Java

Samual Sam

Samual Sam

Updated on 25-Jun-2020 11:36:40

1K+ Views

Import the following package for Calendar class in Java.import java.util.Calendar;Firstly, create a Calendar object and display the current date and time.Calendar calendar = Calendar.getInstance(); System.out.println("Current Date and Time = " + calendar.getTime());Now, let us increment the hours using the calendar.add() method and Calendar.HOUR_OF_DAY constant.calendar.add(Calendar.HOUR_OF_DAY, +5);Example Live Demoimport java.util.Calendar; public class Demo ... Read More

Animate border-color property with CSS

Samual Sam

Samual Sam

Updated on 25-Jun-2020 11:31:45

745 Views

To implement animation on the border-color property with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 500px;             height: 300px;             background: yellow;             border: 10px solid gray;             animation: myanim 3s infinite;             background-position: bottom left;             background-size: 50px;          }          @keyframes myanim {             20% {                border-color: red;             }          }                     Performing Animation for color of border          

Java Program to print the diamond shape

Samual Sam

Samual Sam

Updated on 25-Jun-2020 11:19:22

206 Views

A diamond shape can be printed by printing a triangle and then an inverted triangle. An example of this is given as follows −* * * * * * * * * * * * * * * * * * * * * * * * * * * ... Read More

Ternary Operator in Java

Samual Sam

Samual Sam

Updated on 25-Jun-2020 11:14:54

1K+ Views

A ternary operator uses 3 operands and it can be used to replace the if else statement. This can be done to make the code simpler and more compact.The syntax of the ternary operator is given as follows −Expression ? Statement 1 : Statement 2In the above syntax, the expression ... Read More

Set a bit for BigInteger in Java

Samual Sam

Samual Sam

Updated on 25-Jun-2020 11:07:41

139 Views

The setBit() method is used in Java to return a BigInteger whose value is equivalent to this BigInteger with the designated bit set.Example Live Demoimport java.math.*; public class BigIntegerDemo {    public static void main(String[] args) {       BigInteger one, two;       one = new BigInteger("7");   ... Read More

Java Program to flip a bit in a BigInteger

Samual Sam

Samual Sam

Updated on 25-Jun-2020 11:02:24

103 Views

To flip a bit in a BigInteger in Java, use the flipBit() method. This method returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped.Example Live Demoimport java.math.*; public class Demo {    public static void main(String[] args) {       BigInteger one, two;   ... Read More

Shift left in a BigInteger in Java

Samual Sam

Samual Sam

Updated on 25-Jun-2020 10:59:45

142 Views

To shift left in a BigInteger, use the shiftLeft() method.The java.math.BigInteger.shiftLeft(int n) returns a BigInteger whose value is (this

Create a queue using LinkedList class in Java

Samual Sam

Samual Sam

Updated on 25-Jun-2020 10:40:41

177 Views

To create a queue using LinkedList class, try the following −Queue q = new LinkedList(); q.offer("abc"); q.offer("def"); q.offer("ghi"); q.offer("jkl"); q.offer("mno"); q.offer("pqr"); q.offer("stu"); q.offer("vwx");After that to print the elements, you need to use check a condition for Queue as shown below −Object ob; while ((ob = q.poll()) != null) {   ... Read More

Replace an element of a Java LinkedList

Samual Sam

Samual Sam

Updated on 25-Jun-2020 10:37:47

2K+ Views

An element in an Java LinkedList can be replaced using the java.util.ArrayList.set() method. This method has two parameters i.e the index at which the LinkedList element is to be replaced and the element that it should be replaced with. ArrayList.set() method returns the element that was at the position specified ... Read More

Advertisements