To set orange border to an element, use the border-warning class − Danger (Orange border) Set the style for the element − .mystyle { width: 200px; height: 100px; margin: 10px; } Let us see an example to implement the border-warning class in Bootstrap −ExampleLive Demo Bootstrap Example .mystyle { width: 200px; height: 100px; margin: 10px; } The following are two Rectangles: Danger (Orange border)
Use the border-white class in Bootstrap 4 to set white border to an element. This has white border The test class above styles the element as shown below − .test { width: 120px; height: 100px; margin: 10px; background: blue; } Let us see an example to implement the border-white class in Bootstrap −ExampleLive Demo Bootstrap Example .test { width: 120px; height: 100px; margin: 10px; background: blue; } Two Rectangles This has white border This has orange border
Use the border-0 class in Bootstrap to eliminate all borders from an element as shown below − No border We have also set CSS style above −.mystyle { width: 120px; height: 100px; margin: 10px; background: gray; }You can try to run the following code to implement the border-0 class −ExmapleLive Demo Bootstrap Example .mystyle { width: 120px; height: 100px; margin: 10px; background: gray; } Two Rectangles orange border No border
Use the .btn-outline-dark class in Bootstrap to set dark outline on a button.The following is an example of a button with dark outline −Set the above outline to the button, using the btn-outline-dark class as shown below − Submit You can try to run the following code to implement the btn-outline-dark class −ExampleLive Demo Bootstrap Example Bootstrap 4 Learning btn-outline-dark class usage: Submit
The conditional operator (? :) is a ternary operator (it takes three operands). The conditional operator works as follows −The first operand is implicitly converted to bool. It is evaluated and all side effects are completed before continuing.If the first operand evaluates to true (1), the second operand is evaluated.If the first operand evaluates to false (0), the third operand is evaluated.The result of the conditional operator is the result of whichever operand is evaluated — the second or the third. Only one of the last two operands is evaluated in a conditional expression. The evaluation of the conditional operator ... Read More
Ideally No. But, using the tricky code, a subclass can override a private method as well. See the example below −ExampleLive Democlass A { private void display() { System.out.println("A.display"); } public void callDisplay() { System.out.println("A.callDisplay"); display(); } } class B extends A { private void display() { System.out.println("B.display"); } public void callDisplay() { System.out.println("B.callDisplay"); display(); } } public class Tester { public static void main(String[] args) { ... Read More
Chained exception helps to relate one exception to other. Often we need to throw a custom exception and want to keep the details of an original exception that in such scenarios we can use the chained exception mechanism. Consider the following example, where we are throwing a custom exception while keeping the message of the original exception.ExampleLive Demopublic class Tester { public static void main(String[] args) { try { test(); }catch(ApplicationException e) { System.out.println(e.getMessage()); } } ... Read More
Byte StreamsJava byte streams are used to perform input and output of 8-bit bytes. Though there are many classes related to byte streams but the most frequently used classes are, FileInputStream and FileOutputStream. Following is an example which makes use of these two classes to copy an input file into an output file −Exampleimport java.io.*; public class CopyFile { public static void main(String args[]) throws IOException { FileInputStream in = null; FileOutputStream out = null; try { in = new ... Read More
The java.io.File class provides useful methods on file. This example shows how to check a file existence by using the file.exists() method of File class.Exampleimport java.io.File; public class Main { public static void main(String[] args) { File file = new File("C:/java.txt"); System.out.println(file.exists()); } }ResultThe above code sample will produce the following result (if the file "java.txt" exists in 'C' drive).trueExampleThe following is another simple example of the file exist or not in java.import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintpWriter; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public ... Read More
The java.io.File class provides useful methods on file. This example shows how to check a file hidden or not by using the file.isHidden() method of File class.Exampleimport java.io.File; public class Main { public static void main(String[] args) { File file = new File("C:/java.txt"); System.out.println(file.isHidden()); } }ResultThe above code sample will produce the following result (if the file "java.txt" exists and is hidden in 'C' drive).true
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP