A MAC address of a device is a media access control address. It is a unique identifier assigned to a network.The MAC address technology is used by many technologies such as Ethernet, Bluetooth, Fibre Channel, etc.Here, we will use the following method to check for all the network interfaces on the computer.NetworkInterface.GetAllNetworkInterfacesFor this, the NetworkInterfaceType Enumeration is also used to specify the type of network interfaces.string addr = ""; foreach (NetworkInterface n in NetworkInterface.GetAllNetworkInterfaces()) { if (n.OperationalStatus == OperationalStatus.Up) { addr += n.GetPhysicalAddress().ToString(); break; } } return addr;Above, we have used the ... Read More
To find intersection of two lists in C#, use the Intersect() method.The following is our list 1.List list1 = new List(); list1.Add(2); list1.Add(3); list1.Add(5); list1.Add(7);The following is our list 2.List list2 = new List(); list2.Add(5); list2.Add(4); list2.Add(6); list2.Add(8);The following is the code to find the intersection of two lists in C#.Example Live Demousing System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Demo { public class Program { public static void Main(String[] args) { List list1 = new List(); list1.Add(2); list1.Add(3); list1.Add(5); ... Read More
Java uses call by value while passing parameters to a function. To swap objects, we need to use their wrappers. See the example below −Example Live Demopublic class Tester{ public static void main(String[] args) { A a = new A(); A b = new A(); a.value = 1; b.value = 2; //swap using objects swap(a, b); System.out.println(a.value +", " + b.value); Wrapper wA = new Wrapper(a); Wrapper wB = new ... Read More
We can create Thread by either by implementing a runnable interface or by extending Thread class. Below are the detailed steps of using both ways to create Thread.Create a Thread by Implementing a Runnable InterfaceIf your class is intended to be executed as a thread then you can achieve this by implementing a Runnable interface. You will need to follow three basic steps −Step 1As a first step, you need to implement a run() method provided by a Runnable interface. This method provides an entry point for the thread and you will put your complete business logic inside this method. ... Read More
Use the [attribute] selector to select elements with an attribute, for example, an alt attribute or a target attribute, etc.You can try to run the following code to implement the CSS[attribute] selector,ExampleLive Demo img[alt] { border: 3px solid orange; }
Consider the following code snippet where we divide a number by 0.Example Live Demopublic class Tester{ public static void main(String[] args) { double d = 100; System.out.println(d/0); } }OutputInfinityNow consider the following code snippet.Example Live Demopublic class Tester{ public static void main(String[] args) { int d = 100; System.out.println(d/0); } }OutputException in thread "main" java.lang.ArithmeticException: / by zero at Tester.main(Tester.java:5)As you've noted, the Infinity vs ArithmeticException, a different result for similar divide by zero program. The difference lies in floating point arithmetic used in first program and integer arithmetic used in second program.
To set left tooltip, use the right CSS property.You can try to run the following code to set left tooltip to a text:ExampleLive Demo .mytooltip .mytext { visibility: hidden; width: 140px; background-color: orange; color: white; z-index: 1; top: -6px; right: 100%; text-align: center; border-radius: 6px; padding: 5px 0; position: absolute; } .mytooltip { position: relative; display: inline-block; margin-left: 150px; } .mytooltip:hover .mytext { visibility: visible; } Keep mouse cursor over me My Tooltip text
A set is a collection which does not allows duplicate values. HashSet is an implementation of a Set. Following are the ways in which we can initialize a HashSet in Java.Using constructor − Pass a collection to Constructor to initialize an HashSet.Using addAll() − Pass a collection to Collections.addAll() to initialize an HashSet.Using unmodifiableSet() − Pass a collection to Collections.unmodifiableSet() to get a unmodifiable Set.Using add() − Using add(element) method of Set.Following is an example of using above ways.ExampleInfinityNow consider the following code snippet.Example Live Demoimport java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class Tester{ public ... Read More
To set the navigation bar at bottom, use position: fixed property, with bottom property.You can try to run the following code to implement a menu that stays on the bottom, ExampleLive Demo ul { list-style-type: none; position: fixed; bottom: 0; width: 100%; } li { float: left; ... Read More
With CSS, you can add a small arrow to the tooltip, using :after. With that, use the content property as well.You can try to run the following code to add an arrow in the tooltip:ExampleLive Demo .mytooltip .mytext { visibility: hidden; width: 140px; background-color: blue; color: #fff; z-index: 1; bottom: 100%; left: 60%; margin-left: -90px; text-align: center; ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP