Bootstrap 4 Border Danger Class

Alex Onsman
Updated on 16-Jun-2020 08:52:41

304 Views

Use the border-danger class to set a red border to an element.Set the border-danger class to an element as if we include any other class −   Red Border Above, we have also set another class “new”, to style the element − .new {   width: 120px;   height: 120px;   margin: 20px; } You can try to run the following code to implement the border-danger class −ExampleLive Demo       Bootstrap Example                             .new {       width: 120px;       height: 120px;       margin: 20px;      }         Rectangle with red border:   Red Border

Convert Java Array to Iterable

V Jyothi
Updated on 16-Jun-2020 08:52:32

9K+ Views

To make an array iterable either you need to convert it to a stream or as a list using the asList() or stream() methods respectively. Then you can get an iterator for these objects using the iterator() method.ExampleLive Demoimport java.util.Arrays; import java.util.Iterator; public class ArrayToIterable {    public static void main(String args[]){       Integer[] myArray = {897, 56, 78, 90, 12, 123, 75};       Iterator iterator = Arrays.stream(myArray).iterator();       while(iterator.hasNext()) {          System.out.println(iterator.next());       }    } }Output897 56 78 90 12 123 75As mentioned above, you can also convert ... Read More

Count Java Comments in a Text File

Samual Sam
Updated on 16-Jun-2020 08:49:25

546 Views

You can read the contents of a file using the Scanner class and You can find the comments in a particular line using contains() method.Exampleimport java.io.*; import java.util.Scanner; public class FindingComments {    public static void main(String[] args) throws IOException {       Scanner sc = new Scanner(new File("HelloWorld"));       String input;       int single = 0;       int multiLine = 0;       while (sc.hasNextLine()) {          input = sc.nextLine();          if (input.contains("/*")) {             multiLine ++;       ... Read More

Create Block Element on Specific Screen Width with Bootstrap 4

Ricky Barnes
Updated on 16-Jun-2020 08:48:20

547 Views

To create a block on a specific screen width, use the .d-*-block class.The specific screen width can be small, medium, large and extra large. Set the class indivifually based on the screen size as shown below − d-sm-block d-md-block d-lg-block< /span> d-xl-block Let us see the complete example to learn how to create a block element on a specific screen width −ExampleLive Demo       Bootstrap Example                             Blocks     Resize the browser to check the effect     d-block     d-sm-block     d-md-block     d-lg-block     d-xl-block  

Java Parent and Child Classes Explained

usharani
Updated on 16-Jun-2020 08:47:34

17K+ Views

Java supports inheritance, an OOPs concept where one class acquires the members (methods and fields) of another.You can inherit the members of one class from another, use the extends keyword as:class A extends B{}The class which inherits the properties of other is known as child class (derived class, sub class) and the class whose properties are inherited is known as parent class (base class, superclass class).Following is an example which demonstrates inheritance. Here, we have two classes namely Sample and MyClass. Where Sample is the parent class and the class named MyClass is the child class.ExampleLive Democlass Sample{    public ... Read More

Create a Flexbox Container with Bootstrap 4

Ricky Barnes
Updated on 16-Jun-2020 08:46:21

281 Views

Use the d-flex class in Bootstrap to create a flexbox container.Here, I have set two flex items −     One   Two Above, I have used the d-flex class to set the container. The container has both the flex items styled using the bg-primary and bg-warning classes respectively.Let us see the complete example −ExampleLive Demo       Bootstrap Example                             Understanding Flex             One       Two      

Delete Elements from an Array

Sai Subramanyam
Updated on 16-Jun-2020 08:45:29

1K+ Views

To delete an element at a particular position from an array. Starting from the required position, replace the element in the current position with the element in the next position.Example Live Demopublic class DeletingElementsBySwapping { public static void main(String args[]) { int [] myArray = {23, 93, 56, 92, 39}; System.out.println("hello"); int size = myArray.length; int pos = 2; for (int i = pos; i

Set a Green Border to an Element in Bootstrap to Indicate Success

Ricky Barnes
Updated on 16-Jun-2020 08:44:11

234 Views

To set green border, use the border-success class in Bootstrap 4.The below element will have green border since we have set the class of the as border-success class −   Green border You can try to run the following code to set green border to an element indicating success −ExampleLive Demo       Bootstrap Example                              .mystyle {        width: 150px;        height: 150px;        margin: 10px;      }       Rectangle   Green border

Move Array Element from One Position to Another in Java

karthikeya Boyini
Updated on 16-Jun-2020 08:43:04

14K+ Views

To move an element from one position to other (swap) you need to –Create a temp variable and assign the value of the original position to it.Now, assign the value in the new position to original position.Finally, assign the value in the temp to the new position.ExampleLive Demoimport java.util.Arrays; public class ChangingPositions {    public static void main(String args[]) {       int originalPosition = 1;       int newPosition = 4;       int [] myArray = {23, 93, 56, 92, 39};       int temp = myArray[originalPosition];       myArray[originalPosition] = myArray[newPosition];       myArray[newPosition] = temp;       System.out.println(Arrays.toString(myArray));    } }Output[23, 39, 56, 92, 93]

Bootstrap 4 Button btn-outline-warning Class

Alex Onsman
Updated on 16-Jun-2020 08:42:22

299 Views

To set an outline on a button that indicates warning, you need to use the btn-outline class in Bootstrap.For my class, I have taken the below button −   Warning (Errors) The button above has the class btn-outline-warning that allow us to add an orange outline stating warning action −You can try to run the following code to implement the btn-outline-warning class −ExampleLive Demo       Bootstrap Example                         Warning   The following are the warning messages:       semi-colon (;) missing     infinite loop     For more warning messages:   Warning (Errors)

Advertisements